Not quite sure why it's even available because I cannot find any documentation on how to make a custom post type hierarchical other than in the optional parameter 'hierarchical' => true....Can someone please give me a basic example of a hierarchical custom post type and the child custom post type?

For example, if I wanted to create a custom post type of "Crayon Box" and a child custom post type of "Crayon", how would one do this? Again, I am more than willing to read through some documentation but there is absolutely nothing that I can find on this in the Wordpress Codex.

UPDATE: I did read in one post where someone used post_parent but I am also unable to find documentation on this parameter...

2 Answers 2


One custom post type cannot be the child of another. hierarchical means: Each post can have children of the same post type, like pages.

If you need relationships between different post types use the Posts 2 Posts plugin.
Another option would be a custom hierarchical taxonomy for two post types. You could use it to assign the first post type to the parent terms and the second to the child terms of that taxonomy. That's probably as messy as it sounds. :)

  • Yes, it does sound messy. Not quite sure why this functionality is not there. It seems to me that this would be a widely used architecture...and everyone seems to reply with the same thing..."use the Posts 2 Posts plugin". Not griping about your reply because at least you explained that it can't happen, but just upset that it actually can't happen :) do you know if WP plans on adding this as functionality any time soon?
    – clockwiseq
    Oct 2, 2012 at 1:37
  • See the discussion in core.trac.wordpress.org/ticket/14513.
    – fuxia
    Oct 2, 2012 at 11:08
  • @toscho You can definitely have parent and child relationships for heterogeneous post types; we do it all the time. It often takes some coding to expose all the desired functionality, but it definitely works and works well. Sep 9, 2014 at 15:49
  • @MikeSchinkel Two years ago(!) almost everything regarding hierarchical post types was hard-coded in WordPress.
    – fuxia
    Sep 9, 2014 at 18:04
  • @toscho Yes, but were implementing heterogenous parent-child post types 3 years ago. Just sayin… :) Sep 9, 2014 at 22:03

What functionality do you need? It might be best to use custom taxonomies as toscho mentioned. That way, you can query in the same sort of manner I envisage you wanting by having a child post type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.