Been looking for someone with this same problem for hours now so I decided to post my own thread.

I have a hierachical custom post type called contact-information. Using this I have parentpages which contain no information, and childpages which does! In the single-contact-information.php I’ve set a redirect rule that redirects a parent to its first child. This works like a charm!

However! Just a few days ago the childpages suddenly started going 404 on me! It seems the pages do exist, and they are indeed set as children of the parents, but the permalinks doesnt work. Here’s my permalink-structure, the basic one:

/%year%/%monthnum%/%day%/%postname%/

So basically:

mysite.com/contact-information/parentpage/childpage

DOESNT work, but

mysite.com/contact-information/childpage

DOES WORK, aswell as

mysite.com/contact-information/parentpage

Here’s the code for creating the custom post type, it’s from the Custom post types UI plugin:

register_post_type('contact-information', array(    'label' => 'Contact info','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => true,'rewrite' => array('slug' => ''),'query_var' => true,'supports' => array('title','revisions','page-attributes',),'labels' => array (
  'name' => 'Contact info',
  'singular_name' => 'Contact information',
  'menu_name' => 'Contact info',
  'add_new' => 'Add Contact information',
  'add_new_item' => 'Add New Contact information',
  'edit' => 'Edit',
  'edit_item' => 'Edit Contact information',
  'new_item' => 'New Contact information',
  'view' => 'View Contact information',
  'view_item' => 'View Contact information',
  'search_items' => 'Search Contact info',
  'not_found' => 'No Contact info Found',
  'not_found_in_trash' => 'No Contact info Found in Trash',
  'parent' => 'Parent Contact information',
),) );

EDIT:

I just tried creating a CPT by myself aswell in functions using http://themergency.com/generators/wordpress-custom-post-types/
and the issue remains so I’m pretty sure it’s got to do with the permalinks, I just have no idea what!

3 Answers
3

I battled to create hierarchical for post types and custom taxonomies and then found this great code, maybe you can use it to make a date based sctructure: https://wordpress.stackexchange.com/a/55366/17048

Leave a Reply

Your email address will not be published. Required fields are marked *