Using nonce external of WP Admin

All,
I’ve got two wordpress pages. One wordpress page displays a form to do some registration stuff for the website. The second wordpress page actually processes the data and inserts it into a custom MySQL table that I have. I’d like to use the nonce functionality inherit to WordPress. The user doesn’t have to be a WordPress admin or have any type of permissions to be able to do it.

Can anyone give me an example or show me how to do this outside of the WP Admin in a WordPress page?

Read More

Thanks for any advice in advance!

Related posts

Leave a Reply

1 comment

  1. Nonces are not tied to the admin interface. This codex page explains them very well. Essentially, you add :

    <?php wp_nonce_field('name_of_my_action', 'name_of_nonce_field'); ?>
    

    in your form (this creates a hidden input field containing an one-time-use token). And where you’re doing the form processing you just check if the nonce is correct

    if(!wp_verify_nonce($_POST['name_of_nonce_field'], 'name_of_my_action')){
      // no permissions
    }