Assigning CPT as post child to another CPT results in 404 for single-childpost.php


I have two custom post types: movie and screening.

screening is a child of movie, and a movie can have several screenings/children.

(screening is registered as hierarchical, both are publicly queryable)

I’m using this set-up instead of post meta to act as a pseudo-parent mainly because of 2 reasons

  1. It just seems more logical / wordpress-ish
  2. Hopefully provides a small performance improvement in db queries as I can just use something like get_children() instead of querying the post_meta table for multiple $post_parent matches.

However, it seems WP doesn’t like posts with parents from another post type, which leads to a 404 when trying to view single-screening.php

I’ve tried a lot of tweaks to the $args when registering both post types, always flushing the permalinks afterwards ( wp rewrite flush ), some stuff with add_rewrite_rule() and add_filter( 'post_type_link' ... ) with no luck so far.

Any ideas?

tdj 1 month 0 Answers 11 views 0

Leave an answer