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:
@@ -603,7 +603,7 @@ function wp_validate_auth_cookie($cookie = '', $scheme = '') {
|
||||
$expired = $expiration = $cookie_elements['expiration'];
|
||||
|
||||
// Allow a grace period for POST and Ajax requests
|
||||
if ( defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
||||
if ( wp_doing_ajax() || 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
||||
$expired += HOUR_IN_SECONDS;
|
||||
}
|
||||
|
||||
@@ -1104,7 +1104,7 @@ function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
|
||||
do_action( 'check_ajax_referer', $action, $result );
|
||||
|
||||
if ( $die && false === $result ) {
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
||||
if ( wp_doing_ajax() ) {
|
||||
wp_die( -1 );
|
||||
} else {
|
||||
die( '-1' );
|
||||
|
||||
Reference in New Issue
Block a user