From f85592021d2a6b549e5c7e2a30e135af1634b85c Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 7 Nov 2012 22:09:05 +0000 Subject: [PATCH] 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 --- wp-includes/query.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index fe3e24f0ed..882d027914 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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;