Use proper field for category intersection queries. fixes #9985

git-svn-id: https://develop.svn.wordpress.org/trunk@11501 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-06-01 17:12:12 +00:00
parent 7150af568d
commit c6555c2442
1 changed files with 4 additions and 1 deletions

View File

@ -1915,7 +1915,10 @@ class WP_Query {
$q['tag_id'] = $reqtag['term_id'];
}
$taxonomy_field = $item == ('tag_slug__and' || 'tag_slug__in') ? 'slug' : 'term_id';
if ( in_array( $item, array('tag_slug__and', 'tag_slug__in' ) ) )
$taxonomy_field = 'slug';
else
$taxonomy_field = 'term_id';
$q[$item] = array_unique($q[$item]);
$tsql = "SELECT p.ID FROM $wpdb->posts p INNER JOIN $wpdb->term_relationships tr ON (p.ID = tr.object_id) INNER JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) INNER JOIN $wpdb->terms t ON (tt.term_id = t.term_id)";