0

Does anyone know how to exclude all tagged posts from WP_Query loop?

I can do it with 'tag__not_in' for specific tag IDs – see below:

<?php $loop = new WP_Query( array( 'post_type' => 'poetry', 'posts_per_page' => -1, 'orderby' => 'date', 'order' => 'ASC', 'tag__not_in' => array(8, 9) ) ); ?>

But I was wanting to eliminate all tagged posts without updating the tag IDs in the 'tag__not_in'.

Cheers,

Damian

1 Answer 1

0

Use the tax_query parameter with the taxonomy set as post_tag. See the following previous answer:

Get all posts without tags

1
  • No problem, could you mark the question as answered?
    – Svartbaard
    Mar 24, 2017 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.