If you are using Wordpress 2.0.4 or higher, you can use the field wp_nonce_fieldand wp_verify_nonceto test. There are several examples in the Wordpress documentation (which I posted below).
In your form:
<form method="post">
<?php wp_nonce_field('name_of_my_action','name_of_nonce_field'); ?>
</form>
In process of treatment:
<?php
if ( empty($_POST) || !wp_verify_nonce($_POST['name_of_nonce_field'],'name_of_my_action') )
{
print 'Sorry, your nonce did not verify.';
exit;
}
else
{
}
source
share