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(); + } } /*