What I'm trying to do: Have a script that will go trough every taxonomy of a custom post type, then list the posts that are with that taxonomy.
<?php $taxos = get_categories( 'taxonomy='.$taxonomy.'&post_type='.$type.'&orderby=term_group' ); ?> <?php if($taxos) : foreach($taxos as $taxoOnglet) : ?> <?php $ongletQuery = new WP_Query(array( 'post_type' => $type, $taxonomy => $taxoOnglet->slug, 'showposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', )); ?> [...]loop for showing the posts[...] <?php endif; ?> <?php wp_reset_query(); ?>
I do get all my posts with that query fine, but there is a problem. The parent taxonomies list their children's posts, even if the post is only attributed to the children.
Which gives me something like this
PARENT TAXONOMY Post A Post B CHILD A Post A CHILD B Post B
So I'm trying to find a way to remove the A and B posts from the parent taxonomy, so they will only appear in the child where they are attributed. Is there a way to do this with the WP_Query of WP?