Exclude term exclusions even if they are also inclusions. props foofy, scribu. see #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d23ca4da48
commit
e2879c73fa
|
@ -542,9 +542,6 @@ function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
|
||||||
return ' AND 0 = 1';
|
return ' AND 0 = 1';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !in_array( $operator, array( 'IN', 'NOT IN' ) ) )
|
|
||||||
$operator = 'IN';
|
|
||||||
|
|
||||||
$taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
|
$taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
|
||||||
|
|
||||||
$terms = array_unique( (array) $terms );
|
$terms = array_unique( (array) $terms );
|
||||||
|
@ -587,16 +584,14 @@ function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
else {
|
elseif ( 'NOT IN' == $operator ) {
|
||||||
// NOT IN is very slow for some reason
|
$where .= " AND $primary_table.$primary_id_column NOT IN (
|
||||||
$where .= " AND $primary_table.$primary_id_column IN (
|
SELECT object_id
|
||||||
SELECT object_id
|
FROM $wpdb->term_relationships
|
||||||
FROM $wpdb->term_relationships
|
WHERE term_taxonomy_id IN ($terms)
|
||||||
WHERE term_taxonomy_id $operator ($terms)
|
|
||||||
)";
|
)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return compact( 'join', 'where' );
|
return compact( 'join', 'where' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue