How to exclude a specific taxonomy term from taxonomy archive page
-
Hey guys,
I have an archive page for one of my taxonomies “Property Builder” (taxonomy-property-builder.php) currently using a standard loop that feeds in corresponding posts to each particular taxonomy archive (see example link below). The standard loop (
if(have_posts()) : while(have_posts()) : the_post();
) works fine, however I am trying to exclude the posts tagged with a specific term (‘quick-move-in’) from a different taxonomy (‘property-type’).See the following link to one of my builder taxonomy archive pages (Parkwood Homes). Below the copy text is the posts feed where you will see three posts. I simply need to exclude the (in this case) first post, “QUICK MOVE IN – 8405 E. 49TH DRIVE” (which is tagged as a “Quick Move In” of the “Property Type” taxonomy – https://www.stapletondenver.com/builders-in-stapleton/parkwood-homes/
I have tried a series of things including “tax_query” (see code below) and more, only to no success.
$the_query = new WP_Query( array( 'post_type' => 'property', 'tax_query' => array( array( 'taxonomy' => 'property-type', 'field' => 'slug', 'terms' => 'quick-move-in', 'operator' => 'NOT IN') ), ) );
I know this is a very detailed description but I just want to be sure it makes sense what I am trying to do :/ All and any help is appreciated, thanks in advance!!
- The topic ‘How to exclude a specific taxonomy term from taxonomy archive page’ is closed to new replies.