Use group by for meta key queries. Props filosofo. fixes #9167 for trunk

git-svn-id: https://develop.svn.wordpress.org/trunk@10598 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-02-19 19:17:06 +00:00
parent e09712d208
commit 023dca55ec
1 changed files with 1 additions and 5 deletions

View File

@ -1789,10 +1789,6 @@ class WP_Query {
$q['cat'] = implode(',', $req_cats);
}
if ( !empty($q['category__in']) ) {
$groupby = "{$wpdb->posts}.ID";
}
if ( !empty($q['category__in']) ) {
$join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
$whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
@ -1869,7 +1865,7 @@ class WP_Query {
}
}
if ( !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) {
if ( !empty($q['category__in']) || !empty($q['meta_key']) || !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) {
$groupby = "{$wpdb->posts}.ID";
}