Make WordPress Core

Ticket #41196: 41196.patch

File 41196.patch, 665 bytes (added by nileshdudakiya94, 8 years ago)

has-patch has-unit-tests added

  • src/wp-includes/query.php

     
    2525 */
    2626function get_query_var( $var, $default = '' ) {
    2727        global $wp_query;
    28         return $wp_query->get( $var, $default );
     28        if ( ! isset( $wp_query ) ) {
     29                                _doing_it_wrong( __FUNCTION__, __( 'Retrieving query variables will not work before the query is run. Before then, they always return false.' ), '3.1.0' );
     30                                return false;
     31        } else {
     32                 return $wp_query->get( $var, $default );
     33        }       
    2934}
    3035
    3136/**