Optimize get_tax_sql(). See #12891

git-svn-id: https://develop.svn.wordpress.org/trunk@16413 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu
2010-11-17 01:56:01 +00:00
parent 26f88f4b0f
commit 92fae02550
2 changed files with 128 additions and 102 deletions

View File

@@ -1933,6 +1933,11 @@ class WP_Query {
// Taxonomies
$q['tax_query'] = $this->parse_tax_query( $q );
if ( !empty( $q['tax_query'] ) ) {
$clauses = call_user_func_array( 'get_tax_sql', array( $q['tax_query'], $wpdb->posts, 'ID', &$this) );
$join .= $clauses['join'];
$where .= $clauses['where'];
if ( empty($post_type) ) {
$post_type = 'any';
$post_status_join = true;
@@ -1940,8 +1945,6 @@ class WP_Query {
$post_status_join = true;
}
$where .= get_tax_sql( $q['tax_query'], "$wpdb->posts.ID" );
// Back-compat
$tax_query_in = wp_list_filter( $q['tax_query'], array( 'operator' => 'IN' ) );
if ( !empty( $tax_query_in ) ) {