Make WordPress Core

Changeset 26874


Ignore:
Timestamp:
12/27/2013 07:29:39 PM (11 years ago)
Author:
wonderboymusic
Message:

In WP_Query::get_queried_object(), move the check for $query['terms'] to a place where $query is actually set. This should be included if [26864] makes it into 3.8.1.

Props SergeyBiryukov.
See #26728, [26864], #26634, #26627.

File:
1 edited

Legend:

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

    r26864 r26874  
    32723272            } elseif ( $this->is_tag ) {
    32733273                $term = get_term( $this->get( 'tag_id' ), 'post_tag' );
    3274             } elseif ( $query['terms'] ) {
     3274            } else {
    32753275                $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );
    32763276                $query = reset( $tax_query_in_and );
    32773277
    3278                 if ( 'term_id' == $query['field'] )
    3279                     $term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
    3280                 else
    3281                     $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
     3278                if ( $query['terms'] ) {
     3279                    if ( 'term_id' == $query['field'] ) {
     3280                        $term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
     3281                    } else {
     3282                        $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
     3283                    }
     3284                }
    32823285            }
    32833286
Note: See TracChangeset for help on using the changeset viewer.