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

Matthew McGarity matthew at mcgarity.me
Fri Nov 4 12:28:10 UTC 2011


On Thu, Nov 3, 2011 at 10:17 PM, Mike Schinkel
<mikeschinkel at newclarity.net>wrote:

> On Nov 3, 2011, at 11:11 PM, Matthew McGarity wrote:
> > Using the post_parent field, can you have a parent/child relationship
> > between two different hierarchical CPTs?
>
> Yes.
>
> > 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?
> >
> > http://example.com/parks/yosemite/half-dome/
> >
> > 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.
>
>
> When you say "we have these properly related via the post_parent field",
> what did you do to handle that?  (I ask so we can answer your question.)
>

@Mike Thanks for the reply. We have a custom metabox on Features, whose
dropdown is a list of the Parks posts we want to use as parents.  Upon
save, we are committing the selected Park's post ID to the Feature's
post_parent field.

MMc...

Matthew McGarity
http://mcgarity.me
@mcgaritydotme <


More information about the wp-hackers mailing list