Don't call get_term_by() in get_queried_object() if we have no terms. props wonderboymusic. fixes #21967.

git-svn-id: http://core.svn.wordpress.org/trunk@22450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-07 22:09:05 +00:00
parent 837fadc3dc
commit f85592021d
1 changed files with 2 additions and 2 deletions

View File

@ -2995,10 +2995,10 @@ class WP_Query {
if ( 'term_id' == $query['field'] )
$term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
else
elseif ( $query['terms'] )
$term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
if ( $term && ! is_wp_error($term) ) {
if ( ! empty( $term ) && ! is_wp_error( $term ) ) {
$this->queried_object = $term;
$this->queried_object_id = (int) $term->term_id;