Make WordPress Core


Ignore:
Timestamp:
04/15/2019 11:48:11 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Bootstrap/Load: After [45016], make sure wp_die() does not cause _doing_it_wrong() notices if called before $wp_query global is set.

Props tmdesigned, TimothyBlynJacobs.
Fixes #46813.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r45185 r45206  
    29462946 * @since 5.1.0 The `$link_url`, `$link_text`, and `$exit` arguments were added.
    29472947 *
     2948 * @global WP_Query $wp_query Global WP_Query instance.
     2949 *
    29482950 * @param string|WP_Error  $message Optional. Error message. If this is a WP_Error object,
    29492951 *                                  and not an Ajax or XML-RPC request, the error's messages are used.
     
    29722974 */
    29732975function wp_die( $message = '', $title = '', $args = array() ) {
     2976    global $wp_query;
    29742977
    29752978    if ( is_int( $args ) ) {
     
    30173020        $function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
    30183021    } elseif ( wp_is_xml_request()
    3019         || function_exists( 'is_feed' ) && is_feed()
    3020         || function_exists( 'is_comment_feed' ) && is_comment_feed()
    3021         || function_exists( 'is_trackback' ) && is_trackback() ) {
     3022        || isset( $wp_query ) &&
     3023            ( function_exists( 'is_feed' ) && is_feed()
     3024            || function_exists( 'is_comment_feed' ) && is_comment_feed()
     3025            || function_exists( 'is_trackback' ) && is_trackback() ) ) {
    30223026        /**
    30233027         * Filters the callback for killing WordPress execution for XML requests.
Note: See TracChangeset for help on using the changeset viewer.