[wp-hackers] Parent/child relationship between two different hierarchical CPTs

Matthew McGarity matthew at mcgarity.me
Fri Nov 4 03:11:35 UTC 2011

Apologies if this has been answered before -- it's a tricky subject to
search for in the wp-hackers archives.

Using the post_parent field, can you have a parent/child relationship
between two different hierarchical CPTs?

For example, let's say I have two CPTs, whose permalinks might look
something like the following when non-related to one another:

Parks -- http://example.com/parks/yosemite/
Features -- http//example.com/features/half-dome/

When related, could you have a URL like the following?


In practice, this doesn't work on our test site, although I believe our
register_post_type() call is correct and we have these properly related via
the post_parent field.

FYI -- before you propose using a custom taxonomy, we were proposing
different CPTs because each would be tracking different custom fields and
display different meta boxes.  We could dynamically display/hide these
based on taxonomy, if needed; I'm still curious about the basic question

Thanks in advance!


Matthew McGarity

More information about the wp-hackers mailing list