How to set parent-child relationship between differents custom post types

Posted by Prem Tiwari | Updated on

The cartoon-series can be registered as you did but episodes custom post types can not be hirarchical (I think WordPress expects parent content be the same type as child content if the relationship is set using post_parent in wp_posts database table).

When registering episodes, the rewrite rule must be set to the slug you want, that is cartoon-series/%series_name%. Then we can filter the episodes link to replace %series_name% with actual name of the parent cartoon-series post type and a rewrite rule to say to WordPress when a cartoon-series post type is requested and when is a episodes.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers