diff --git a/wp-includes/class-wp-ajax-response.php b/wp-includes/class-wp-ajax-response.php index 2b981b0b1..296c7bae1 100644 --- a/wp-includes/class-wp-ajax-response.php +++ b/wp-includes/class-wp-ajax-response.php @@ -131,6 +131,6 @@ class WP_Ajax_Response { foreach ( (array) $this->responses as $response ) echo $response; echo ''; - die(); + wp_die(); } } diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 7f90ee514..6f7030ae6 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2043,15 +2043,13 @@ function wp_nonce_ays( $action ) { * @param string $title Error title. * @param string|array $args Optional arguments to control behavior. */ -function wp_die( $message, $title = '', $args = array() ) { +function wp_die( $message = '', $title = '', $args = array() ) { if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) - die('-1'); - - if ( function_exists( 'apply_filters' ) ) { - $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler'); - } else { - $function = '_default_wp_die_handler'; - } + $function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' ); + elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) + $function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); + else + $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' ); call_user_func( $function, $message, $title, $args ); } @@ -2102,7 +2100,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) { $message .= "\n
"; } - if ( !function_exists( 'did_action' ) || !did_action( 'admin_head' ) ) : + if ( ! did_action( 'admin_head' ) ) : if ( !headers_sent() ) { status_header( $r['response'] ); nocache_headers(); @@ -2206,7 +2204,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) { - +