Make WordPress Core


Ignore:
Timestamp:
11/18/2010 07:04:47 PM (14 years ago)
Author:
markjaquith
Message:

Exclude term exclusions even if they are also inclusions. props foofy, scribu. see #12891

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r16466 r16467  
    543543        }
    544544
    545         if ( !in_array( $operator, array( 'IN', 'NOT IN' ) ) )
    546             $operator = 'IN';
    547 
    548545        $taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
    549546
     
    588585            $i++;
    589586        }
    590         else {
    591             // NOT IN is very slow for some reason
    592             $where .= " AND $primary_table.$primary_id_column IN (
    593                 SELECT object_id
    594                 FROM $wpdb->term_relationships
    595                 WHERE term_taxonomy_id $operator ($terms)
     587        elseif ( 'NOT IN' == $operator ) {
     588            $where .= " AND $primary_table.$primary_id_column NOT IN (
     589                SELECT object_id
     590                FROM $wpdb->term_relationships
     591                WHERE term_taxonomy_id IN ($terms)
    596592            )";
    597593        }
    598594    }
    599 
    600595    return compact( 'join', 'where' );
    601596}
Note: See TracChangeset for help on using the changeset viewer.