check_ajax_referer

Fires once the Ajax request has been validated or not.

Description

do_action( 'check_ajax_referer', (string) $action, (false|int) $result ); 

Parameters (2)

0. $action (string)
The Ajax nonce action.
1. $result (false|int)
False if the nonce is invalid, 1 if the nonce is valid and generated between 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'check_ajax_referer', $action, $result ); 
The following example is for adding a hook callback.
  1. // define the check_ajax_referer callback 
  2. function action_check_ajax_referer( $action, $result ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'check_ajax_referer', 'action_check_ajax_referer', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'check_ajax_referer', 'action_check_ajax_referer', 10, 2 ); 

Defined (1)

The action is defined in the following location(s).

/wp-includes/pluggable.php  
  1. do_action( 'check_ajax_referer', $action, $result );