WordPress.org

Make WordPress Core

Ticket #41196: query.php.patch

File query.php.patch, 503 bytes (added by netweblogic, 4 years ago)

Suggested patch for get_query_var

  • query.php

     
    2525 */
    2626function get_query_var( $var, $default = '' ) {
    2727        global $wp_query;
     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        }
    2832        return $wp_query->get( $var, $default );
    2933}
    3034