Looks like the advanced tax query options in WordPress does not allow the following query:

Get me the most recent posts but only those posts that have at least one term under the taxonomy I'm interested in ( here the key thing is "any term" under that taxonomy would be OK to qualify that post to be part of the results )

The taxonomy query samples I've seen so far does things like this

Get me the most recent posts but only those posts that have term A and term B of that taxonomy. ( Here, the limiting thing is that I must specify the terms I want and I do not seem to have an option to say, "all terms" or "any term"

Am I correct in saying that what I want is not possible with the current query params?

1 Answer 1


You can do what you want with the tax_query parameter since version 4.1, use EXISTS as the operator parameter in your tax query.

$args = array(
    'post_type' => 'post',
    'tax_query' => array(
            'taxonomy' => 'mytax',
            'operator' => 'EXISTS'
$query = new WP_Query( $args );
  • Hey Milo, what if you need to combine this with another term; say category='featured' , how would the $args be changing? We need the relation AND, there. Right? Feb 23, 2017 at 23:37

Your Answer

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

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