diff --git wp-includes/query.php wp-includes/query.php
index 0ed1fab575..4c21af453f 100644
--- wp-includes/query.php
+++ wp-includes/query.php
@@ -25,6 +25,7 @@
  */
 function get_query_var( $var, $default = '' ) {
 	global $wp_query;
+    if( ! isset( $wp_query ) || ! method_exists( $wp_query, 'get' ) ) return $default;
 	return $wp_query->get( $var, $default );
 }
 
