WP_Async_Task::verify_async_nonce( string $nonce )
Description #
Verify that the correct nonce was used within the time limit.
Parameters #
- $noncestring (Required) Nonce to be verified
Source #
File: lib/class-wp-async-task.php
protected function verify_async_nonce( $nonce ) {
$action = $this->get_nonce_action();
$i = wp_nonce_tick();
// Nonce generated 0-12 hours ago
if ( substr( wp_hash( $i . $action . get_class( $this ), 'nonce' ), - 12, 10 ) == $nonce ) {
return 1;
}
// Nonce generated 12-24 hours ago
if ( substr( wp_hash( ( $i - 1 ) . $action . get_class( $this ), 'nonce' ), - 12, 10 ) == $nonce ) {
return 2;
}
// Invalid nonce
return false;
}
Expand full source code Collapse full source code View on GitHub: lib/class-wp-async-task.php:212
Add your comment