I have a query on a page and I want to prevent it from returning posts in the parent term that have one of the child terms of the parent. For example:
- Post 1
- Post 2
Here's the query I'm currently using, but I haven't figured out how to prevent repetition of posts at the parent level.
<?php $taxonomy = 'seo_resource_topics'; // Gets every "category" (term) in this taxonomy to get the respective posts $terms = get_terms( $taxonomy ); foreach( $terms as $term ) : echo '<h3>'. $term->name. '</h3>'; $resourcequery = new WP_Query(array( 'post_type' => 'seo_resource', 'taxonomy' => $taxonomy, 'term' => $term->slug, 'posts_per_page' => -1 )); if( $resourcequery->have_posts() ): while( $resourcequery->have_posts() ) : $resourcequery->the_post(); ?>