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

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 7 10:26:00 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):

 > Scribu, I'd really like to be able to determine the operator between
 taxonomies, and be able to group terms. Is there something about my
 proposed syntax that you objected to?

 The main problem I have with it is that it's akward to build a query
 progressively. Here is some code from my Query Multiple Taxonomies plugin:

 {{{
         $query = array();
         foreach ( $wp_query->_qmt_query as $taxname => $value )
                 foreach ( explode( '+', $value ) as $value )
                         $query[] = wp_tax( $taxname, explode( ',', $value
 ), 'slug' );

         $post_ids = $wpdb->get_col( wp_tax_query( wp_tax_group( 'AND',
 $query ) ) );
 }}}

 You tell me if it's readable or not.

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


More information about the wp-trac mailing list