Proper check for tax query, which will never be empty, due to 'relation'. See #15752

git-svn-id: https://develop.svn.wordpress.org/trunk@16844 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu 2010-12-09 17:09:42 +00:00
parent a5cb537970
commit a2387d8907
1 changed files with 35 additions and 37 deletions

View File

@ -1939,10 +1939,9 @@ class WP_Query {
$search = apply_filters_ref_array('posts_search', array( $search, &$this ) ); $search = apply_filters_ref_array('posts_search', array( $search, &$this ) );
// Taxonomies // Taxonomies
if ( !$this->is_singular ) { if ( $this->is_category || $this->is_tag || $this->is_tax ) {
$this->tax_query = $this->parse_tax_query( $q ); $this->tax_query = $this->parse_tax_query( $q );
if ( ! empty( $this->tax_query ) ) {
$clauses = call_user_func_array( 'get_tax_sql', array( $this->tax_query, $wpdb->posts, 'ID', &$this) ); $clauses = call_user_func_array( 'get_tax_sql', array( $this->tax_query, $wpdb->posts, 'ID', &$this) );
$join .= $clauses['join']; $join .= $clauses['join'];
@ -1985,9 +1984,8 @@ class WP_Query {
} }
} }
} }
}
if ( !empty( $this->tax_query ) || !empty( $q['meta_key'] ) ) { if ( $this->is_category || $this->is_tag || $this->is_tax || !empty( $q['meta_key'] ) ) {
$groupby = "{$wpdb->posts}.ID"; $groupby = "{$wpdb->posts}.ID";
} }