mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Re-purpose wp_die() for ajax responses.
* Allows unit testing of core ajax actions. * wp_die() now has separate filters to choose a handler depending on the context (ajax, XML-RPC, else). * wp_die) in ajax context does not need to be called with a string. Conversion takes place before die(). props kurtpayne, see #15327. git-svn-id: https://develop.svn.wordpress.org/trunk@19801 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -829,8 +829,12 @@ function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
|
||||
|
||||
$result = wp_verify_nonce( $nonce, $action );
|
||||
|
||||
if ( $die && false == $result )
|
||||
die('-1');
|
||||
if ( $die && false == $result ) {
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
||||
wp_die( -1 );
|
||||
else
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
do_action('check_ajax_referer', $action, $result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user