WP_Query post_parent__in sometimes not working
-
I’m using the following query to pull content from various subpages (defined as a ‘post_parent__in’ array) and collect and display that content on another page:
<?php $query = new WP_Query( array( 'post_type' => 'page', 'post_parent__in' => array( 80, 128, 5379 ) ) ); ?>
128 is a top-level page.
80 and 5379 are child pages of 128, but have child pages of their own.With all three IDs in the array, only the requested content from 5379’s child pages is displayed.
When the array includes only 80 and 5379, the requested content from both 80 and 5379’s child pages is displayed.
When the array includes only 128 and 5379, the requested content from both 128 and 5379’s child pages is displayed.
When the array includes only 80 and 128, no requested content is displayed.
If any one of the IDs is listed by itself in the array, the requested content is displayed.
My guess is there’s some kind of conflict because 80 is a child page of 128. I don’t know what it would be though, since 5379 is also a child page, and it plays nicely with the other two. Since the query seems to be working in most of the variations, I’m not sure where to start.
I started working with this in 3.6, and updated to 3.7 just in case that was a factor. No change.
Any help would be greatly appreciated.
- The topic ‘WP_Query post_parent__in sometimes not working’ is closed to new replies.