How can I combine posts of different types in one hierarchy?

Is there a better way to do this using custom taxonomies?

You’re right on the money there. Rather than try to make a custom post into the child of a standard post (because you can’t), I’d recommend using a custom taxonomy to order things.

Essentially, you could build a custom hierarchical taxonomy and use it to “categorize” both standard posts and custom posts. You’d mark your standard posts as the parent in the taxonomy and your custom posts as the child.

A second option

Another option would be to use a custom field for parental inheritance. This might be a bit faster to code and more intuitive to use (plus it will give you some added control).

Add a custom meta field to your custom post type called “parents.” This can then be a list of post IDs the child post should be nested under. When you need to call up the list, you can do a quick query to SELECT all of your custom posts that have the parent ID in question in their “parents” list.

Leave a Comment