check_admin_referer
Action HookDescription
Fires once the admin request has been validated or not.Hook Information
File Location |
wp-includes/pluggable.php
View on GitHub
|
Hook Type | Action |
Line Number | 1305 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$action
|
The nonce action. |
false|int
|
$result
|
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 Examples
Basic Usage
<?php
// Hook into check_admin_referer
add_action('check_admin_referer', 'my_custom_function', 10, 2);
function my_custom_function($action, $result) {
// Your custom code here
}
Source Code Context
wp-includes/pluggable.php:1305
- How this hook is used in WordPress core
<?php
1300 *
1301 * @param string $action The nonce action.
1302 * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between
1303 * 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1304 */
1305 do_action( 'check_admin_referer', $action, $result );
1306
1307 if ( ! $result && ! ( -1 === $action && str_starts_with( $referer, $adminurl ) ) ) {
1308 wp_nonce_ays( $action );
1309 die();
1310 }
PHP Documentation
<?php
/**
* Fires once the admin request has been validated or not.
*
* @since 1.5.1
*
* @param string $action The nonce action.
* @param false|int $result 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.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/pluggable.php
Related Hooks
Related hooks will be displayed here in future updates.