I’m getting a 404 page when viewing child-pages of a custom post type. Right now I have a pages (let’s call it ‘Books’) that displays every ‘book’, and in the menu have other pages listed under Books which are currently giving me a 404 error. Here is my custom post type registration:
$args = array( 'labels' => $labels, 'public' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'capability_type' => 'post', 'hierarchical' => true, 'menu_link' => 5, 'supports' => array('title','editor','thumbnail','author', 'page-attributes'), 'rewrite' => array( 'slug' => __('books', 'sproingcreative') ) );
I’ve tried removing ‘query_var’ => true and even setting it to false, and although setting it to false stopped the 404 error, the individual posts within the CPT no longer work. Has anyone had this issue before?
UPDATE: Changing the page’s slug did the trick, it works fine now!
Read more here:: Custom Post Type Child Pages