mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-11 02:49:04 +01:00
Use group by for meta key queries. Props filosofo. fixes #9167 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@10598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5c82bfb14c
commit
92f96f913b
@ -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";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user