mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@38334 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -334,7 +334,7 @@ function wp_debug_mode() {
|
||||
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
|
||||
}
|
||||
|
||||
if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
||||
if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || wp_doing_ajax() ) {
|
||||
@ini_set( 'display_errors', 0 );
|
||||
}
|
||||
}
|
||||
@@ -1027,3 +1027,21 @@ function wp_is_ini_value_changeable( $setting ) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the current request is a WordPress Ajax request.
|
||||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @return bool True if it's a WordPress Ajax request, false otherwise.
|
||||
*/
|
||||
function wp_doing_ajax() {
|
||||
/**
|
||||
* Filter whether the current request is a WordPress Ajax request.
|
||||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request.
|
||||
*/
|
||||
return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user