Don't pollute the 'tax_query' query var. See #12891

git-svn-id: http://svn.automattic.com/wordpress/trunk@16402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu
2010-11-16 16:22:09 +00:00
parent 99f3141859
commit 690cd434d1
2 changed files with 7 additions and 8 deletions

View File

@@ -593,17 +593,15 @@ function get_tax_sql( $tax_query, $object_id_column ) {
}
if ( 1 == count( $sql ) ) {
$ids = $wpdb->get_col( $sql[0] );
$r = $wpdb->get_col( $sql[0] );
} else {
$r = "SELECT object_id FROM $wpdb->term_relationships WHERE 1=1";
foreach ( $sql as $query )
$r .= " AND object_id IN ($query)";
$ids = $wpdb->get_col( $r );
}
if ( !empty( $ids ) )
return " AND $object_id_column IN(" . implode( ', ', $ids ) . ")";
return " AND $object_id_column IN($r)";
else
return ' AND 0 = 1';
}