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

WordPress Trac wp-trac at lists.automattic.com
Thu Nov 18 03:38:58 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:  ongoing-project
----------------------------+-----------------------------------------------

Comment(by foofy):

 The subquery for NOT IN added in r12891 is not quite right as it includes
 posts with the excluded terms so long as the post has other terms that are
 not excluded. I moved the NOT in front of the subquery and MySQL shows
 that either way it scans the same number of rows.

 {{{
 $where .= " AND $primary_table.$primary_id_column NOT IN (
         SELECT object_id
         FROM $wpdb->term_relationships
         WHERE term_taxonomy_id IN ($terms)
 )";
 }}}

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


More information about the wp-trac mailing list