Created
September 4, 2014 06:30
-
-
Save hykw/65fb50edf11edf1cd9bc to your computer and use it in GitHub Desktop.
wordpress: nonce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$nonce = wp_nonce_field('pagename', '_wpnonce', true, false); | |
<form> | |
{$nonce} | |
</form> | |
--------------------- | |
if(is_page('pagename') && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'pagename')) { | |
# | |
} else { | |
wp_redirect('/originalpage', 301); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment