This issue seems to be quite common, but the solutions that worked for others haven’t worked for me.
I’m using the CPT UI plugin and have created a CPT called ‘courses’ with the following settings:
register_post_type('courses', array( 'label' => 'Courses', 'description' => '', 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => true, 'rewrite' => array('slug' => 'courses', 'with_front' => true), 'query_var' => true, 'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes','post-formats'), 'labels' => array ( 'name' => 'Courses', 'singular_name' => 'Course', 'menu_name' => 'Courses', 'add_new' => 'Add Course', 'add_new_item' => 'Add New Course', 'edit' => 'Edit', 'edit_item' => 'Edit Course', 'new_item' => 'New Course', 'view' => 'View Course', 'view_item' => 'View Course', 'search_items' => 'Search Courses', 'not_found' => 'No Courses Found', 'not_found_in_trash' => 'No Courses Found in Trash', 'parent' => 'Parent Course', )
I then have a specialized page template for /courses called ‘page-courses.php’ and a template called ‘single-courses.php’ for any posts within the courses custom post type.
Up to now everything worked correctly.
Next, I created a new page with the slug of ‘questions-checkout’ and ‘courses’ as it’s parent. It is this page that gives a 404.
I’ve tried the following to get it working:
- In admin: settings > permalinks and resaved added
flush_rewrite_rules();to functions.php and refreshed the ‘questions-checkout’ page
- Installed ‘rewrite rules’ plugin and flushed the rewrite rules
Created a new custom post type using CPT UI.
Using one or more of the above 3 fixes does indeed fix the 404 on ‘questions-checkout’. However, I then get a 404 on posts within the courses page e.g. /courses/post-title.
I’ve made sure there are no categories, tags etc that have the name ‘questions-checkout’.
I’m using WordPress 3.9.1 multisite.
Read more here: Custom post type child page 404