Advanced Tax Query

Below is my tax query, at the moment this returns all posts which have at least one of the specified terms.

Is there a way I can have it return only posts which have ALL of the specified terms?

[tax_query] => Array
    (
        [relation] => AND
        [0] => Array
            (
                [taxonomy] => services
                [field] => term_id
                [terms] => Array
                    (
                        [0] => 3
                        [1] => 10
                        [2] => 6
                        [3] => 9
                    )

                [operator] => IN
            )

        [1] => Array
            (
                [taxonomy] => awards
                [field] => term_id
                [terms] => Array
                    (
                        [0] => 13
                        [1] => 12
                    )

                [operator] => IN
            )

    )

2 Answers
2

Try [operator] => AND in both the sub-arrays. I think that will work from my reading of WP_Tax_Query::get_sql().

Leave a Comment