From 09806c6b5f47fe2bbd914d1a7c5bb1b8055e8cfa Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 26 Sep 2012 12:32:54 +0000 Subject: [PATCH] Convert the object in the posts array to WP_Post only if the posts array is not empty. Some post caching plugins can cause it to be empty. see #21309 git-svn-id: http://core.svn.wordpress.org/trunk@22011 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index edb5ba6dd9..60228dbbec 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -2676,7 +2676,8 @@ class WP_Query { } // Convert to WP_Post objects - $this->posts = array_map( 'get_post', $this->posts ); + if ( $this->posts ) + $this->posts = array_map( 'get_post', $this->posts ); // Raw results filter. Prior to status checks. if ( !$q['suppress_filters'] )