Revert taxonomy.php part of [16402]. Not fully backed yet. See #12891

git-svn-id: http://svn.automattic.com/wordpress/trunk@16403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-11-16 16:24:14 +00:00
parent 690cd434d1
commit af6dbfde54
1 changed files with 4 additions and 2 deletions

View File

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