Recall & Review
beginner
What is a nonce in WordPress?
A nonce is a special token used to verify that a request comes from a trusted source, helping to protect against attacks like CSRF (Cross-Site Request Forgery).
Click to reveal answer
beginner
How do you create a nonce in WordPress?
Use the function
wp_create_nonce('action_name') to generate a nonce tied to a specific action.Click to reveal answer
beginner
Which function verifies a nonce in WordPress?
The function
wp_verify_nonce($nonce, 'action_name') checks if the nonce is valid and was created for the given action.Click to reveal answer
beginner
Why should you verify a nonce before processing form data?
Verifying a nonce ensures the form submission is genuine and prevents unauthorized or malicious requests from being processed.
Click to reveal answer
beginner
What happens if nonce verification fails in WordPress?
If verification fails, you should stop processing the request and show an error or redirect, protecting your site from potential attacks.
Click to reveal answer
Which WordPress function generates a nonce?
✗ Incorrect
The function wp_create_nonce() is used to generate a nonce in WordPress.
What is the main purpose of nonce verification?
✗ Incorrect
Nonce verification helps prevent CSRF attacks by ensuring requests are from trusted sources.
Which function checks if a nonce is valid?
✗ Incorrect
wp_verify_nonce() is the function used to verify if a nonce is valid.
When should you verify a nonce in your code?
✗ Incorrect
Nonce verification should happen before processing form data to ensure security.
What should you do if nonce verification fails?
✗ Incorrect
If nonce verification fails, stop processing the request and show an error to protect the site.
Explain what a nonce is in WordPress and why it is important.
Think about how websites keep forms safe from fake submissions.
You got /3 concepts.
Describe the steps to create and verify a nonce in WordPress when handling a form submission.
Consider what happens before showing the form and after receiving the form data.
You got /4 concepts.