Validate Requests In WordPress Using Nonce

Paulund is full of premium tutorials and support to help with your development

Sign up to get full access to all tutorials.

Get full access for $5/mo

Login to your account


There are loads requests that you can perform in WordPress from either forms or links that will do things like updating database values or deleting posts. If you are deleting a post or updating any value in the database by using a link then you will able to delete a post by typing a URL into the browser, this can dangerous as this can be abused to delete all the posts on your blog. You need a way of verifying a request is valid and to stop duplicate requests from a URL. In WordPress you can verify a request by using a nonce. What Is A Nonce? A nonce is used for security reasons to protect the system from unexpected or duplicate requests. This will help protect against the same requests being sent to the database. A nonce is used as a one time token to identify a request on...