Working with wordpress nonce for securing forms and ajax

September 17th, 2020 Shabu James 368 Views 0 Uncategorised22 seconds
<?php wp_nonce_field( 'name_of_my_action', 'name_of_nonce_field' ); ?>
if ( 
    ! isset( $_POST['name_of_nonce_field'] ) 
    || ! wp_verify_nonce( $_POST['name_of_nonce_field'], 'name_of_my_action' ) 
) {
 
   print 'Sorry, your nonce did not verify.';
   exit;
 
} else {
 
   // process form data
}

About The Author

Shabu James

Leave Your Thoughts Here...

We are glad you have chosen to leave a comment. Please keep in mind that comments are moderated according to our comment policy.

Name *
Comment

We are glad you have chosen to leave a comment. Please keep in mind that comments are moderated according to our comment policy.