1
I have a sub page listing some Custom Posts.
The sub page opens normally and lists the custom posts, but when I click to open the post gives page not found.
Registration of the Custom Post:
add_action( 'init', 'register_cpt_injecao' );
function register_cpt_injecao(){
$labels = array(
'name' => 'Cursos de Injeção de Plásticos',
'singular_name' => 'Curso',
'add_new' => 'Add Novo',
'add_new_item' => 'Add Novo Curso',
'edit_item' => 'Editar Cursos de Injeção de Plásticos',
'new_item' => 'Novo Cursos de Injeção de Plásticos',
'view_item' => 'View Curso',
'search_items' => 'Buscar Cursos de Injeção de Plásticos',
'not_found' => 'Nenhum Curso encontrado',
'not_found_in_trash' => 'Nenhum Curso na lixeira',
'parent_item_colon' => 'Parent Curso:',
'menu_name' => 'Cursos de Injeção de Plásticos',
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'thumbnail'),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => array("slug" => "cursos/cursos-de-injecao-de-plasticos"),
//'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'injecao', $args );
}
If I leave the rewrite set as TRUE, the page single-shot.php opens normal displaying its content, but then what happens is that the sub page (courses/courses-of-injection-plastic) gives error 404...
Any solution to this URL rewriting problem? I tried several things but when one works the other gives error, I don’t know what else to do.