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:
parent
731933638d
commit
f3b433cec3
|
@ -3271,15 +3271,18 @@ 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'] ) {
|
||||||
|
if ( 'term_id' == $query['field'] ) {
|
||||||
$term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
|
$term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
|
||||||
else
|
} else {
|
||||||
$term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
|
$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 ) ) {
|
||||||
$this->queried_object = $term;
|
$this->queried_object = $term;
|
||||||
|
|
Loading…
Reference in New Issue