[wp-trac] [WordPress Trac] #12891: Advanced multi-taxonomy WP_Query()s

WordPress Trac wp-trac at lists.automattic.com
Wed Dec 8 01:32:00 UTC 2010


#12891: Advanced multi-taxonomy WP_Query()s
-----------------------------+----------------------------------------------
 Reporter:  markjaquith      |        Owner:  markjaquith
     Type:  task (blessed)   |       Status:  closed     
 Priority:  normal           |    Milestone:  3.1        
Component:  Query            |      Version:  3.0.1      
 Severity:  normal           |   Resolution:  fixed      
 Keywords:  ongoing-project  |  
-----------------------------+----------------------------------------------

Comment(by Otto42):

 Replying to [comment:180 mikeschinkel]:
 > Thanks.  I actually read that link first and wasn't clear on the above.
 >
 > So I'll turn the question around; are there types of logic that it
 cannot handle?

 Yes. It can't do arbitrary combinations of AND's and OR's across multiple
 taxonomies.
 For example, there is no way to specify cat=A AND (tag=B OR format=C).

 "Groupings" of terms are always either "IN" or "NOT IN" and must be single
 taxonomies. The AND/OR is global across those groupings. This is flexible
 enough for almost any conceivable real-life case.

 And it's not really as limiting as it seems, when you consider that A AND
 (B OR C) can often be rewritten as (A AND B) OR (A AND C). The idea is to
 get the bits in your groupings to all be of the same taxonomy, and the
 connecting pieces to those groupings to all be of the same type (AND or
 OR).

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12891#comment:181>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list