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

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 6 20:56:45 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 mikeschinkel):

 Replying to [comment:17 scribu]:
 > So, simple usage:
 >
 > {{{
 > query_posts( array(
 >   'tag' => 'foobar',
 >   'color' => 'green'
 > ) );
 > }}}
 >
 > Advanced usage:
 >
 > {{{
 > query_posts( array(
 >   'taxonomy_query' => array(
 >     'taxonomy' => 'post_tag',
 >     'terms' => array( 'foobar' ),
 >   ), array(
 >     'taxonomy' => 'color',
 >     'terms' => array( 'green', 'white' ),
 >     'operator' => 'AND'
 >   )
 > ) );
 > }}}

 How to handle complex `OR`, especially when `post_meta` needs to be
 considered, i.e. in pseudo-SQL

 {{{
 WHERE
    (META team = Bulldogs AND (TERM color IN red AND black)
       OR
    (META team = Yellow Jackets AND (TERM color IN white AND gold)
 }}}

 ?

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


More information about the wp-trac mailing list