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

I have tags on posts and I want a display based on the following logic: If it has the "biology" tag AND it has either the "female" or "male" tag.

biology AND (female OR male)

Here's what I attempted but it didn't work: http://www.example.org/tag/biology+female,male

Obviously the above is ambiguous, is there a way to do what I'm needing?

share|improve this question

You can achieve this with a tax_query, though by default not via any sort of URL manipulation:

$args = array(
    'post_type' => 'post',
    'tax_query' => array(
        'relation' => 'AND',
            'taxonomy' => 'post_tag',
            'field' => 'slug',
            'terms' => array( 'biology' )
            'taxonomy' => 'post_tag',
            'field' => 'slug',
            'terms' => array( 'male', 'female' ),
            'operator' => 'IN'
$query = new WP_Query( $args );

If you wanted to do this via URL, you'd have to come up with some way to pass the terms so you could intercept and create the query.

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.