WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to query posts which do not have tags assigned to them?


Ty very much!

share|improve this question
up vote 3 down vote accepted

Either use the tag_not_in parameter if you have the tag id and if not then you can use tax_query parameter like so:

$tag_to_exclude = 'example_tag';
$args = array(
'posts_per_page' => -1,
'tax_query' => array(
            'taxonomy' => 'post_tag',
            'field' => 'slug',
            'terms' => array($tag_to_exclude),
            'operator' => 'NOT IN',
share|improve this answer

You could get an array of all of the tag ids and send it to the "tag__not_in" parameter. Not the most elegant solution, but I'm not sure how else it would be accomplished.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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