Use proper field for category intersection queries. fixes #9985

git-svn-id: http://svn.automattic.com/wordpress/trunk@11501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-06-01 17:12:12 +00:00
parent ae103262a4
commit 4d9b6b2fe1

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)";