From 0938ef08158fe7c874aad08bef5008416365c67e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 11 Jan 2014 23:56:43 +0000 Subject: [PATCH] Avoid a fatal error in wp_reset_postdata() if $wp_query global is not set. see #26775 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@26932 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/query.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/query.php b/src/wp-includes/query.php index 8d1f199210..8bf292e1fe 100644 --- a/src/wp-includes/query.php +++ b/src/wp-includes/query.php @@ -115,7 +115,10 @@ function wp_reset_query() { */ function wp_reset_postdata() { global $wp_query; - $wp_query->reset_postdata(); + + if ( isset( $wp_query ) ) { + $wp_query->reset_postdata(); + } } /*