WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/09/2010 07:29:21 PM (9 years ago)
Author:
scribu
Message:

Introduce WP_Tax_Query. Fix canonical redirects in the process. See #15752

File:
1 edited

Legend:

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

    r16844 r16849  
    715715     * @since 3.1.0
    716716     * @access public
    717      * @var array
    718      */
    719     var $tax_query = array();
     717     * @var object WP_Tax_Query
     718     */
     719    var $tax_query;
    720720
    721721    /**
     
    15851585        }
    15861586
    1587         _set_tax_query_defaults( $tax_query );
    1588 
    1589         foreach ( $tax_query as $query ) {
    1590             if ( ! is_array( $query ) )
    1591                 continue;
    1592 
     1587        $tax_query_obj = new WP_Tax_Query( $tax_query );
     1588
     1589        foreach ( $tax_query_obj->queries as $query ) {
    15931590            if ( 'IN' == $query['operator'] ) {
    15941591                switch ( $query['taxonomy'] ) {
     
    16051602        }
    16061603
    1607         return $tax_query;
     1604        return $tax_query_obj;
    16081605    }
    16091606
     
    19431940            $this->tax_query = $this->parse_tax_query( $q );
    19441941
    1945             $clauses = call_user_func_array( 'get_tax_sql', array( $this->tax_query, $wpdb->posts, 'ID', &$this) );
     1942            $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
    19461943
    19471944            $join .= $clauses['join'];
     
    19581955
    19591956            // Back-compat
    1960             $tax_query_in = wp_list_filter( $this->tax_query, array( 'operator' => 'IN' ) );
     1957            $tax_query_in = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'IN' ) );
    19611958            if ( !empty( $tax_query_in ) ) {
    19621959                if ( !isset( $q['taxonomy'] ) ) {
     
    26582655        $this->queried_object_id = 0;
    26592656
    2660         $tax_query_in = wp_list_filter( $this->tax_query, array( 'operator' => 'IN' ) );
     2657        $tax_query_in = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'IN' ) );
    26612658        if ( !empty( $tax_query_in ) ) {
    26622659            $query = reset( $tax_query_in );
Note: See TracChangeset for help on using the changeset viewer.