WordPress.org

Make WordPress Core

Changeset 10599


Ignore:
Timestamp:
02/19/09 19:17:22 (5 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7/wp-includes/query.php

    r10150 r10599  
    17911791 
    17921792        if ( !empty($q['category__in']) ) { 
    1793             $groupby = "{$wpdb->posts}.ID"; 
    1794         } 
    1795  
    1796         if ( !empty($q['category__in']) ) { 
    17971793            $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) "; 
    17981794            $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'category' "; 
     
    18701866        } 
    18711867 
    1872         if ( !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) { 
     1868        if ( !empty($q['category__in']) || !empty($q['meta_key']) || !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) { 
    18731869            $groupby = "{$wpdb->posts}.ID"; 
    18741870        } 
Note: See TracChangeset for help on using the changeset viewer.