From b08c4772fa496f4822df49642783c996da31fa45 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 8 Mar 2011 22:06:35 +0000 Subject: [PATCH] Check for WP_Error return from get_term_by(). Props fabifott, kawauso, nacin. fixes #16717 for trunk git-svn-id: https://develop.svn.wordpress.org/trunk@17506 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 95ecb7a640..8725dd81fb 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -2190,7 +2190,7 @@ class WP_Query { if ( !empty( $cat_query ) ) { $cat_query = reset( $cat_query ); $the_cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' ); - if ( $the_cat ) { + if ( $the_cat && ! is_wp_error( $the_cat ) ) { $this->set( 'cat', $the_cat->term_id ); $this->set( 'category_name', $the_cat->slug ); } @@ -2202,7 +2202,7 @@ class WP_Query { if ( !empty( $tag_query ) ) { $tag_query = reset( $tag_query ); $the_tag = get_term_by( $tag_query['field'], $tag_query['terms'][0], 'post_tag' ); - if ( $the_tag ) { + if ( $the_tag && ! is_wp_error( $the_tag ) ) { $this->set( 'tag_id', $the_tag->term_id ); } unset( $the_tag );