WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/07/2014 02:57:53 PM (5 years ago)
Author:
boonebgorges
Message:

In WP_Query::get_queried_object(), use the new format for referencing tax query clauses.

queried_terms, rather than queries, is the tax_query property where a flat
index of terms is stored.

See [29901] for a similar fix in redirect_canonical(). See #29738.

Props dd32.
Fixes #30623.

File:
1 edited

Legend:

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

    r30682 r30771  
    38703870                }
    38713871            } else {
    3872                 $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );
    3873                 $query = reset( $tax_query_in_and );
     3872                // For other tax queries, grab the first term from the first clause.
     3873                $tax_query_in_and = wp_list_filter( $this->tax_query->queried_terms, array( 'operator' => 'NOT IN' ), 'NOT' );
     3874
     3875                $queried_taxonomies = array_keys( $tax_query_in_and );
     3876                $matched_taxonomy = reset( $queried_taxonomies );
     3877                $query = $tax_query_in_and[ $matched_taxonomy ];
    38743878
    38753879                if ( $query['terms'] ) {
    38763880                    if ( 'term_id' == $query['field'] ) {
    3877                         $term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
     3881                        $term = get_term( reset( $query['terms'] ), $matched_taxonomy );
    38783882                    } else {
    3879                         $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
     3883                        $term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
    38803884                    }
    38813885                }
Note: See TracChangeset for help on using the changeset viewer.