check_ajax_referer
Fires once the Ajax request has been validated or not.
Description
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.
- // run the action
- do_action( 'check_ajax_referer', $action, $result );
- The following example is for adding a hook callback.
- // define the check_ajax_referer callback
- function action_check_ajax_referer( $action, $result ) {
- // make action magic happen here...
- };
- // add the action
- add_action( 'check_ajax_referer', 'action_check_ajax_referer', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the action
- 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
- do_action( 'check_ajax_referer', $action, $result );