Okay, not sure what was wrong with my original code, but this post put me on the right path.
To generate the nonce, use:
wp_nonce_field( plugin_basename( __FILE__ ), 'my_reset_nonce',true,false);
To verify, use:
if ( ! isset( $_POST['my_reset_nonce'] ) || ! wp_verify_nonce( ( $_POST['my_reset_nonce'] ), plugin_basename( __FILE__ ) ) ) {
die;
} else {
// Reset the form.
}
Various other variables, conditionals, sanitizing, etc. omitted for clarity.
Related Posts:
- Why am I sometimes getting a 404 error when I try to update a page with Elementor?
- When is it useful to use wp_verify_nonce
- Why Better WP security plugin returns 418 I’m a Teapot “error”?
- Weird problems after recovery from security breach
- Security checking in meta_box save is reluctant?
- wp_create_nonce function doesn’t work inside a plugin?
- 404 errors when updating options in admin dashboard
- wp_verify_nonce fails always
- Is there a plugin that will override the “Error establishing a database connection” message? [closed]
- How Can I Securely Implement a Password-less Login Feature?
- Security and .htaccess
- Loading external page template and enqueue script from plugin causes 403 forbidden error
- Are there procedures to prevent malicious plugin updates?
- Should we use plugins that aren’t available from the official WordPress site?
- PHP Deprecated: Non-static method should not be called statically
- How to check plugins for malicious code?
- How to properly secure my WordPress installation?
- Why allow overriding crucial pluggable functions wp_verify_nonce and wp_create_nonce?
- Where should my plugin POST to?
- Plugins error (Use roles and capabilities instead) on latest version, multisite
- WordPress error – PHP Fatal error: Uncaught Error: Call to undefined function register_block_type_from_metadata()
- Security error WP 4.0 + WP phpBB Bridge [closed]
- “Are you sure you want to do this?” when deactivating all plugins in WordPress 4.3.1 [closed]
- Prevent Brute Force Attack
- How should I handle errors within a plugin?
- Questions about brute force attacks on the admin username, coming from amazon IP addresses
- How to expire all wordpress user passwords instantly?
- Seaweed Plugin not working
- All plugins deactivated due to error
- Should you escape hardcoded URLs?
- Error in the wp-config.php file: PHP Fatal error: Uncaught Error: Unknown named parameter (PHP 8.0)
- Preventing BFA in WordPress without using a plugin
- Error handling a plugin with exceptions
- How to stop xmlrpc attacks without disabling component to allow JetPack to work in WordPress?
- Post-terms-order PHP errors after update
- How to delete Passwrd Protected posts cookies when a user logged out from the site
- Upgraded to latest version – 3.0.3 and Now I get a “sufficient permissions to access this page” error
- How to block plugin activations with no known user or coming from unknown IP address range?
- Check for security updates
- Standard Fail2Ban vs. WP Fail2ban vs. WP Fail2Ban Redux
- Deactivating all plugins and reactivating one by one, fixes conflicts. Why?
- Why can’t I access my Intranet LDAPS with NADI?
- Malicious File Upload [closed]
- Stop Plugin Enumeration [closed]
- Unable to get WP_DEBUG, WP_DEBUG_DISPLAY, WP_DEBUG_LOG to work
- Get errors from WP_Error to different variables
- Hack-Proof OR Security in WordPress — is it real?
- Security and Must Use Plugins
- Is Timthumb still broken? What security measures should be taken?
- help with my wordpress website
- HTTP 500 error after plugin install
- Is it safe to use admin-ajax.php in the frontend?
- How to protect WordPress from security scanner [closed]
- Can’t activate Plugin: unexpected T_STRING, expecting T_FUNCTION [closed]
- Specific way to allow WordPress users to view their current password? And edit it?
- Plugin getting Cannot modify header information errors
- How to prevent plugins from sniffing/stealing other plugins’ options?
- WP-nivo-slider Producing Error “Cannot modify header information – headers already sent by …”
- After updating the WordPress getting a syntax error in the console
- There has been a critical error on your website – won’t fix no matter what
- Plugin showing error
- Plugin upgrade failing during unzip
- Problem after updating plugins
- If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
- How to get Facebook comment plugin in blog? [closed]
- Undefined index: ratings_score …/wp-postratings.php on line 994
- Strange Behavior on New Theme Points to Idiocy
- WP Insert Post If user refreshes override new post
- Error activating certain plugins
- Website Captcha Error: The reCAPTCHA wasn’t entered correctly
- Can I disable xml-rpc by setting it to false?
- Error when adding extensions to wordpress version 5.9 with a DIVI install
- Help to Create a Simple Plugin to make a post
- Replace old theme that understand old css (vcex_icon_box css_animation)
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- There has been a critical error on this website
- How to Fix WordPress multisite woocommerce 403 file error
- There has been a critical error on your website
- Modifying server’s response to API endpoint
- Woocommerce functions in custom class, avoid errors
- Error after installing the WordPress plugin updates
- White blank screen while adding or editing pages in wordpress
- https rewrite not working for All in one security Brute force > rename login url
- WordPress error after installing plugin “Internal Server Error” [closed]
- Need Help Understanding Debug Log Errors
- Plugin debugging with errors in activation routine
- WP default file upload hook not working if used in a plugin
- Redux framework somehow added to my site, can’t locate in plugins
- Validating values using Settings API?
- Plugin (smart archives reloaded) crashed site / no access on admin panel
- Custom Post type plugin breaking the front page shows dashboard?
- Plugin won’t activate, fatal error (widget class not found)
- Problem with permissions in wp-content/plugins
- Plug-in (Slickr Flickr) works on local machine, but not server
- Theme causing SSL break on chrome
- My WP site and password was hacked, what to do? [closed]
- WordPress Customer Reviews Error: Line 239?
- How to resolve these findings from security audit
- Stop the user if login from the cookies
- Oxygen plugin wordpress stuck in loading sequence forever when trying to edit a page [closed]