Custom Post Type ‘hierarchical’ Help!

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.

Read More

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

Related posts

Leave a Reply

2 comments

  1. 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. 🙂

  2. 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.