I've set up some custom post types and wanted to visit the pages but I only get 404 errors.

I've searched the web and it seems to be a known problem, but I didn't find a solution that worked for me.

I saved the permalinks several times and also tried the flush_rewrite_rules( false ); command on every post type. But nothing changes.

If I set the permalink structure to basic, everything works fine, so the post types are ok...

Can anyone think of another problem?

Maybe it's because I used the same permalink for a page (post_type => 'page)? But I've deleted that page and I cannot find anything else than my page of the custom post type with that title in the database. So everything should be fine.

The $args:

$args = array(
    'labels'              => $labels,
    'public'              => true,
    'has_archive'         => true,
    'publicly_queryable'  => true,
    'query_var'           => true,
    'rewrite'             => array(
                              'with_front' => true,
                              'slug'       => 'practical-courses'
    'capability_type'     => 'page',
    'hierarchial'         => true,
    'supports'            => array(
    'menu_position'       => 20,
    'menu_icon'           => '',
    'exclude_from_search' => false,

The register-call:

  • Can you edit your question to include your call to register_post_type? And any custom rewrite rules? – Tim Malone Jul 7 '16 at 9:31
  • Can we see all of the arguments in $args? – Andy Macaulay-Brook Jul 7 '16 at 10:32
  • I've added all the arguments – Sam Jul 8 '16 at 10:47
  • Hi - sorry I didn't see your reply as you didn't reference me in yours. I've pasted your code into functions.php on a test site, created a post, saved my permalink and it just works as expected. That is, localhost/practical-courses/test returns a page. – Andy Macaulay-Brook Jul 24 '16 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.