AJAX: add a new function, wp_doing_ajax(), which can replace... (wait for it...) DOING_AJAX checks via the constant.
Props Mte90, sebastian.pisula, swissspidy. Fixes #25669. Built from https://develop.svn.wordpress.org/trunk@38334 git-svn-id: http://core.svn.wordpress.org/trunk@38275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -2570,7 +2570,7 @@ function wp_die( $message = '', $title = '', $args = array() ) {
|
||||
$title = '';
|
||||
}
|
||||
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
||||
if ( wp_doing_ajax() ) {
|
||||
/**
|
||||
* Filters the callback for killing WordPress execution for Ajax requests.
|
||||
*
|
||||
@@ -3064,7 +3064,7 @@ function _wp_json_prepare_data( $data ) {
|
||||
function wp_send_json( $response ) {
|
||||
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
||||
echo wp_json_encode( $response );
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
||||
if ( wp_doing_ajax() )
|
||||
wp_die();
|
||||
else
|
||||
die;
|
||||
|
||||
Reference in New Issue
Block a user