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

git-svn-id: https://develop.svn.wordpress.org/trunk@16467 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2010-11-18 19:04:47 +00:00
parent 0e87356092
commit 29b90f079d
1 changed files with 5 additions and 10 deletions

View File

@ -542,9 +542,6 @@ function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
return ' AND 0 = 1';
}
if ( !in_array( $operator, array( 'IN', 'NOT IN' ) ) )
$operator = 'IN';
$taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
$terms = array_unique( (array) $terms );
@ -587,16 +584,14 @@ function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
$i++;
}
else {
// NOT IN is very slow for some reason
$where .= " AND $primary_table.$primary_id_column IN (
elseif ( 'NOT IN' == $operator ) {
$where .= " AND $primary_table.$primary_id_column NOT IN (
SELECT object_id
FROM $wpdb->term_relationships
WHERE term_taxonomy_id $operator ($terms)
WHERE term_taxonomy_id IN ($terms)
)";
}
}
return compact( 'join', 'where' );
}