From c6555c2442404ec6c8941e0efc09186e9440685b Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 1 Jun 2009 17:12:12 +0000 Subject: [PATCH] Use proper field for category intersection queries. fixes #9985 git-svn-id: https://develop.svn.wordpress.org/trunk@11501 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/query.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index f9fffe35a4..663133ffb0 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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)";