Google reCAPTCHA verification failed, please try again later.
Home » BLOG » WordPress » Google reCAPTCHA verification failed, please try again later.

Google reCAPTCHA verification failed, please try again later.

category:  Web development, WordPress

When you add the contact form or any forms on your website and web application, it is a good idea to add Google reCaptcha for protecting your website and web application from fraud and abuse.

However, if your website uses the cache plugin, you may see “Google reCAPTCHA verification failed, please try again later.” error while you are trying to submit the form. Why?

Check where the error comes from

You can follow the steps below for identify the issue.

  • Login to WordPress (In my case, I config the cache plugin won’t cache when administrator user logins. This way, if cache configuration causes any issue, I can check it with my administrator user.)
  • Visit the page that you add the form which generates the error
  • Test by submitting the form
  • If you don’t see any error while you are submitting for form then follow the next step
  • Logout from WordPress
  • Visit the page that you add the form which generates the error
  • Open the inspector from the browser(F12) and open the Console tab
  • Test by submitting the form
  • If you see the error says “Google reCAPTCHA verification failed, please try again later.” and also see “Uncaught ReferenceError: grecaptcha is not defined” JS error at the Console tab, that means the cache plugin is a cause for reCaptcha error.

Fix Google reCAPTCHA verification failed

As we check from the steps above, it shows that when you login to WordPress and test the form, there is no issue. But when you logout from WordPress and test the form, there is the issue. Plus your site uses the cache plugin.

In my case, I config the cache plugin by using the minify option for CSS and JS. For reducing the loading page and display the site content to the visitors faster, I config the defer option to JS file as well. And this configuration causes the error.

To fix it, you simply exclude the recaptcha file from the defer option.

In my case, I use LiteSpeed Cache plugin. At the plugin, I will go to page optimization then look for JS Deferred Excludes option. Then add recaptcha/api.js for this option. Save the change and clear the cache. Now, logout from WordPress and test the form again. You should not see any error anymore.

Other issues may be:

  • Google Recaptcha verification code needs to changed. You need to go back to your Recaptcha admin panel and generate new verification code and copy that new code to your site.
  • Your current theme conflicts with Recaptcha js file. You can test it by changing to the default WordPress theme and check the form again. If no error occurs, it means your current them causes the error.
  • Your form won’t work with the current Recaptcha version. There are two versions that you can try which are reCaptcha v2 and v3.