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.



Built from https://develop.svn.wordpress.org/trunk@26874


git-svn-id: http://core.svn.wordpress.org/trunk@26758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2013-12-27 19:30:10 +00:00
parent 731933638d
commit f3b433cec3
1 changed files with 8 additions and 5 deletions

View File

@ -3271,14 +3271,17 @@ class WP_Query {
} }
} elseif ( $this->is_tag ) { } elseif ( $this->is_tag ) {
$term = get_term( $this->get( 'tag_id' ), 'post_tag' ); $term = get_term( $this->get( 'tag_id' ), 'post_tag' );
} elseif ( $query['terms'] ) { } else {
$tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' ); $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );
$query = reset( $tax_query_in_and ); $query = reset( $tax_query_in_and );
if ( 'term_id' == $query['field'] ) if ( $query['terms'] ) {
$term = get_term( reset( $query['terms'] ), $query['taxonomy'] ); if ( 'term_id' == $query['field'] ) {
else $term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
$term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] ); } else {
$term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
}
}
} }
if ( ! empty( $term ) && ! is_wp_error( $term ) ) { if ( ! empty( $term ) && ! is_wp_error( $term ) ) {