[wp-hackers] Grouping taxonomy queries

John Blackbourn johnbillion+wp at gmail.com
Wed Aug 8 02:53:08 UTC 2012


I have a situation where I'd like to perform a tax_query for posts in term
A OR posts in term B AND C. Written another way:

Posts in ( term A ) OR ( term B AND term C )

Terms A, B and C are in different taxonomies, although from a technical
point of view this is not relevant.

What I'm really asking for is to be able to group two of the tax queries
(for terms B and C, using AND as the operator parameter) and then use OR as
the operator parameter between it and the tax query for term A. This is not
possible with the current tax query structure.

Has anyone tackled this or something similar before? It looks to me like
I'll need to drop the tax query and filter the SQL in order to achieve what
I want.

Any suggestions, code samples, etc most welcome.

John


More information about the wp-hackers mailing list