I have a sub page listing some Custom Posts.
The sub page normally opens and lists the custom posts, but when I click to open the page it does not find the page.
Custom Posting Registry:
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 to TRUE , the single-injection.php page opens normal displaying its content, but then what happens is that the sub page / plastic-injection-courses) gives 404 error ...
Any solution to this URL rewrite problem? I tried several things but when one works the other gives error, I do not know what else to do.