Codex tools: Log in
Contents |
Verify that correct nonce was used with time limit.
<?php wp_verify_nonce( $nonce, $action ); ?>
Otherwise, returns an integer, with possible values of 1 or 2.
1 indicates that the nonce has been generated in the past 12 hours or less.2 indicates that the nonce was generated between 12 and 24 hours ago.
<?php $nonce= wp_create_nonce ('my-nonce'); ?>
<a href='myplugin.php?_wpnonce=<?php echo $nonce ?>'> ...
<?php
$nonce=$_REQUEST['_wpnonce'];
if (! wp_verify_nonce($nonce, 'my-nonce') ) die('Security check');
?>
wp_verify_nonce is defined in wp-includes/pluggable.php
Nonce Functions: wp_explain_nonce, wp_nonce_ays, wp_nonce_field, wp_nonce_url, wp_verify_nonce, wp_create_nonce, check_admin_referer, check_ajax_referer