From cbe9f7f3a0fdab1f1578e8e80421ac594ca37e99 Mon Sep 17 00:00:00 2001 From: scribu Date: Mon, 13 Dec 2010 15:11:02 +0000 Subject: [PATCH] Always call WP_Tax_Query::get_sql(). Fixes #15797 git-svn-id: https://develop.svn.wordpress.org/trunk@16893 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/query.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 56e5b48a59..c83fd8fa32 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1356,6 +1356,7 @@ class WP_Query { } $this->parse_tax_query( $qv ); + foreach ( $this->tax_query->queries as $tax_query ) { if ( 'IN' == $tax_query['operator'] ) { switch ( $tax_query['taxonomy'] ) { @@ -1935,22 +1936,22 @@ class WP_Query { // Taxonomies $this->parse_tax_query( $q ); - if ( $this->is_category || $this->is_tag || $this->is_tax ) { - $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' ); + $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' ); - $join .= $clauses['join']; - $where .= $clauses['where']; + $join .= $clauses['join']; + $where .= $clauses['where']; - if ( $this->is_tax ) { - if ( empty($post_type) ) { - $post_type = 'any'; - $post_status_join = true; - } elseif ( in_array('attachment', (array) $post_type) ) { - $post_status_join = true; - } + if ( $this->is_tax ) { + if ( empty($post_type) ) { + $post_type = 'any'; + $post_status_join = true; + } elseif ( in_array('attachment', (array) $post_type) ) { + $post_status_join = true; } + } - // Back-compat + // Back-compat + if ( $this->is_category || $this->is_tag || $this->is_tax ) { $tax_query_in = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'IN' ) ); if ( !empty( $tax_query_in ) ) { if ( !isset( $q['taxonomy'] ) ) {