I'm trying to develop a plugin that implements custom post types and custom taxonomies. The custom taxonomies are all hierarchical. Archive pages for top-level taxonomies should be showing posts that belong to all of their children. However, at the moment, they only seem to be showing posts that belong to one of the taxonomy's children, and stopping there.
I've checked my error logs, and am not seeing anything to indicate why it's only pulling one child term.
For instance, I have one top-level taxonomy that has 2 posts assigned to it. Then, there are four terms that are direct descendants of that top-level term. The first and third children have 2 posts each, the second has 7 posts, and the fourth has 5 posts. Only the fourth term is being included in the archive for that top-level term (along with the 2 posts that belong directly to that top-level term). None of the other child terms are showing up on the page.
Do you guys have any thoughts as to why the query seems to be skipping over the first three child terms?
The only way I am modifying the query is to pull the posts in ascending alphabetical order (by using the
pre_get_posts action and the
set_query_var() method). I've even tried pulling that code out, and it still only shows the fourth child term on that archive page.
I've pasted the relevant code into a Pastebin, in case anyone wants to take a look. Thanks.