Make WordPress Core

Changeset 16402


Ignore:
Timestamp:
11/16/2010 04:22:09 PM (16 years ago)
Author:
scribu
Message:

Don't pollute the 'tax_query' query var. See #12891

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r16385 r16402  
    19321932
    19331933                // Taxonomies
    1934                 $q['tax_query'] = $this->parse_tax_query( $q );
    1935                 if ( !empty( $q['tax_query'] ) ) {
     1934                $tax_query = $this->parse_tax_query( $q );
     1935
     1936                if ( !empty( $tax_query ) ) {
    19361937                        if ( empty($post_type) ) {
    19371938                                $post_type = 'any';
    … …  
    19411942                        }
    19421943
    1943                         $where .= get_tax_sql( $q['tax_query'], "$wpdb->posts.ID" );
     1944                        $where .= get_tax_sql( $tax_query, "$wpdb->posts.ID" );
    19441945
    19451946                        // Back-compat
    1946                         $tax_query_in = wp_list_filter( $q['tax_query'], array( 'operator' => 'IN' ) );
     1947                        $tax_query_in = wp_list_filter( $tax_query, array( 'operator' => 'IN' ) );
    19471948                        if ( !empty( $tax_query_in ) ) {
    19481949                                if ( !isset( $q['taxonomy'] ) ) {
  • trunk/wp-includes/taxonomy.php

    r16382 r16402  
    594594
    595595        if ( 1 == count( $sql ) ) {
    596                 $ids = $wpdb->get_col( $sql[0] );
     596                $r = $wpdb->get_col( $sql[0] );
    597597        } else {
    598598                $r = "SELECT object_id FROM $wpdb->term_relationships WHERE 1=1";
    599599                foreach ( $sql as $query )
    600600                        $r .= " AND object_id IN ($query)";
    601 
    602                 $ids = $wpdb->get_col( $r );
    603601        }
    604602
    605603        if ( !empty( $ids ) )
    606                 return " AND $object_id_column IN(" . implode( ', ', $ids ) . ")";
     604                return " AND $object_id_column IN($r)";
    607605        else
    608606                return ' AND 0 = 1';
Note: See TracChangeset for help on using the changeset viewer.