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

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 6 18:33:09 UTC 2010

#12891: Advanced multi-taxonomy WP_Query()s
 Reporter:  markjaquith     |       Owner:  markjaquith         
     Type:  task (blessed)  |      Status:  assigned            
 Priority:  normal          |   Milestone:  3.1                 
Component:  Query           |     Version:  3.0.1               
 Severity:  normal          |    Keywords:  taxonomies has-patch

Comment(by scribu):

 I think I have something that will satisfy 90% of the use cases. While
 working on #14572, I introduced a helper function: _wp_meta_sql(). It
 takes a list of meta queries.

 A single meta query looks like this:

   'meta_key' => 'foo',
   'meta_value' => 'bar',
   'meta_compare' => '!=',

 I think we can have something similar for taxonomies, which would cover
 90% of the use cases:

   'taxonomy' => 'post_tag',
   'terms' => array('green', 'blue'),
   'operator' => 'IN',

 where 'operator' can be 'IN', 'NOT IN', 'AND' etc.

 WP_Query would be enhanced to recognize multiple taxonomy => value pairs.

 Also, there could be a new 'taxonomy_query' var that would accept a list
 of taxonomy queries.

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

More information about the wp-trac mailing list