WordPress Support: How to Fix Invalid Nonce Error

Posted on November 5, 2024 | Updated on November 5, 2024

If you’ve ever gotten the dreaded “invalid nonce” error while trying to comment on a site or interact with an actionable button, you may wonder why on earth it suddenly occurs and worry over how to fix it.

One of the most common occurrences happens when someone tries to comment on a post on your blog and they get the error message and can’t add their input. Since you’re trying to fix an issue a third-party user has, it can be beyond challenging to rid your site of the invalid nonce error. 

What Causes an Invalid Nonce Error?

Many different things can result in an invalid nonce error. Ask the 478 million website owners using WordPress if the software can be glitchy, and you’ll get a resounding yes. Figuring out why your site is throwing up errors when it hasn’t in the past requires putting on your Sherlock Holmes gear and becoming a bit of a detective.

Start by looking at any additions or updates on your site. Check for automatic updates from WordPress, plugins and your server. 

In one case, the thing causing the invalid nonce error on a website was an update on JetPack. Once we toggled a feature off, the problem disappeared. Some of the main culprits include:

  • Incompatible plugins
  • User has the same API key across multiple devices
  • Problem with WordPress core files

Narrowing down what might be causing the error can help you fix it. 

How Can You Fix an Invalid Nonce Error?

Often, the fastest route to fixing an invalid nonce error is going through a series of troubleshooting steps, testing after each attempt. You may get lucky and solve the issue almost immediately. Or, you may go through all the steps and still battle the problem. 

1. Check Your Plugins

We love a good plugin here at Designerly. Each month, we feature an interesting plugin for our readers to try. However, anytime you add something new to your WordPress site, you risk incompatibility errors. 

Whenever you have issues or errors on your WP site, your first line of defense should be to disable plugins. Go to your dashboard and deactivate every plugin. Check if the error goes away. If it did, start reactivating one plugin at a time, checking between each, to identify which one caused the issue with your site. 

Pro Tip: If you can’t access your WordPress dashboard, go into the backend of your hosted site through cPanel–or whatever program your server uses–navigate to your Public_html folder, pull up WP_Content/Plugins and rename all files by adding an X to the end of the name. This will disable them. You can go back and remove the X to all but the plugin creating the issue. 

2. Ask User to Clear Cache

Sometimes the issue isn’t on your end at all. Your user may have something blocking the site from serving the function properly. Ask the person experiencing the issue, especially if you can’t repeat the error in your tests, to clear their cache and enter the site via an incognito window. 

Caching issues are a common cause of invalid nonce errors. In addition, you may need to clear the cache on your server. To clear your WordPress site cache, go to the dashboard, settings for your caching plugin and look for language such as “delete,” “clear” or “purge cache.”

3. Replace WordPress Core Files

Some errors occur when your core files for WordPress get corrupted. Some plugins tweak the core files. Even after deleting a plugin, you may deal with residual effects and run into problems. 

The simplest fix is to download the core files from WordPress.org and reupload them to the backend of your site.

Pro Tip: Always backup your site before doing any type of update or troubleshooting. While replacing the core files won’t break anything in theory, it is WordPress and a completely corrupted site is always a possibility with any change or even without one.

4. Change Your Theme

You love your site’s theme. You’ve invested time and effort into customizing it to reflect your brand. However, it may be the silent troublemaking causing issues on your site. Try setting your theme to a default option such as Twenty-Twenty. 

Check for the error. If it’s gone, it may be time to look at your theme as the possible culprit for your invalid nonce error. Make sure there isn’t an upgrade available. Reach out to the developer. As a last resort, choose a new theme that doesn’t cause issues and switch to it. 

Helping a Client With Nonce Error

I had a client whose site worked fine. Suddenly, users were complaining they were getting an invalid nonce error. The warning only popped up for some users when they tried to comment or reply on a post discussion thread. 

I hadn’t changed anything we could think of on the site. No major WordPress updates or any other issues. To figure out the problem, we had to go through a number of steps. The best way to troubleshoot any WordPress issue is to just work your way through possible solutions. In the end, if you still have an error, it may be time to call someone with more experience with PHP code. 

Step 1: Cleared the Cache

Since invalid nonce errors are often caused by caching and timing issues, I cleared the cache on the server side. I also asked that the user who had contacted my client clear their browser cache. The issue remained. I was now able to replicate the issue and get the same notification, which helped with troubleshooting.

Step 2: Tested Different Browsers

Although it wasn’t likely, I did a quick check on various browsers. The issue remained.

Step 3: Checked Discussion Settings

Next, I went into the WP dashboard and navigated to General Settings/Discussion. I checked all the settings and toggled things off and on. It sounds ridiculous but sometimes it will fix a problem.

Step 4: Disabled Plugins

My final step was to disable all the plugins, which I was able to do from the dashboard. I then enabled them in alphabetical order. After I reinstated each one, I went to the comment box to test for the error. 

When I got to JetPack, I realized this is where the problem was. I re-enabled all plugins and went on a search for details about the most recent JetPack update.

Step 5: Research and Solution

A simple Google search turned up multiple suggestions to fix the JetPack incompatibility error. The first few things I tried didn’t work and then I stumbled upon a solution that commanded me to try disabling Jetpack comments toggle that says you can comment via WordPress.com or the site. This fixed the issue to my client’s satisfaction but it actually is still there were that toggle to be reinstated. Once can hope it will get fixed on a future update. 

The Takeaway About Fixing Nonce Validation Errors

Finding the right solution may take time and trial and error. Start by disabling various functions, seeing if plugins are incompatible and reading what others have tried that’s worked for them. The WordPress.org forums are full of questions and potential solutions. Not all will work for you but some might. You don’t have to be a coding export to troubleshoot your site. You just need a bit of determination and a plan of attack. 

Related Posts

About The Author

Cooper Adwin is the Assistant Editor of Designerly Magazine. With several years of experience as a social media manager for a design company, Cooper particularly enjoys focusing on social and design news and topics that help brands create a seamless social media presence. Outside of Designerly, you can find Cooper playing D&D with friends or curled up with his cat and a good book.

Leave a Comment