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
This commit is contained in:
Sergey Biryukov 2014-01-11 23:56:43 +00:00
parent 0e6a9edaec
commit 0938ef0815

View File

@ -115,7 +115,10 @@ function wp_reset_query() {
*/ */
function wp_reset_postdata() { function wp_reset_postdata() {
global $wp_query; global $wp_query;
$wp_query->reset_postdata();
if ( isset( $wp_query ) ) {
$wp_query->reset_postdata();
}
} }
/* /*