WPForms Blog

WordPress Tutorials, Tips, and Resources to Help Grow Your Business

ReCAPTCHA for WordPress

How to Add reCAPTCHA in WordPress Contact Forms

by Courtney Robertson on Jun 30, 2016

Do you want to prevent spam emails from your WordPress contact forms? Have you been getting spam form submissions? A lot of those spam submissions are automated with bots. In this article, we will show you how to add reCAPTCHA in Contact Forms to stop spam.

Why Use reCAPTCHA?

1. Blocking spamrecaptcha – By verifying that a human is submitting a form, all automated spam attempts are blocked.

2.  Easy for users – Originally CAPTCHA was created to do two things at the same time.  It helped machines translate non-digital books while fighting spam.  But, the jumbled text was difficult for users to answer correctly.

Google has improved their CAPTCHA tool, reCAPTCHA v2.0, to be much easier for users.

Now instead of entering text, users can just put their mouse over the checkbox and the tool understands that this is not an automated spam bot. This is much easier for users to prove that they are not robots.

Add reCAPTCHA in Contact Forms

The first thing you need to do is install and activate the WPForms plugin. Here’s a step by step guide on how to install a WordPress plugin.

Next, you need to configure reCAPTCHA settings within WordPress. Go to WPForms » Settings.

On the settings page, you will find the reCAPTCHA section.

configure recaptcha settings

reCAPTCHA is a service provided by Google. It is free, but requires a site key and secret key. You can easily generate those keys for your site by clicking on the visit reCAPTCHA link.

Once on the site, click on Get reCAPTCHA to continue.

Get reCAPTCHA

You will be asked to sign in with your Google account. After logging in, you will be redirected to a page where you can register your site for reCAPTCHA.

Enter the name of your website in the label field. This is for your own use, so that you can identify the website if you ever needed to get the keys again.

After that you need to add your website’s domain, such as example.com.

To save your site, click on the Register button.

Add your site to reCAPTCHA

You will now see a page with site key and secret key for your website.

reCAPTCHA site key

Copy your site and secret key, and switch back to WPForms » Settings page. Paste your site and secret keys under the reCAPTCHA settings.

Don’t forget to click on the Save General Settings button to store your changes.

reCAPTCHA keys

Adding reCAPTCHA to Your Form

Let’s create a new form.  You can do this by going to WPForms » Add New.

On the next screen, you need to enter your form name.

Add New WPForm

Next, select the Simple Contact Form template. The basic contact form fields will be selected with this template.

How to add reCAPTCHA to your contact form

It is easy to customize your contact form. Simply drag & drop the fields you want from the left column into the right preview window.

reCAPTCHA contact form preview

Finally, to enable reCAPTCHA in your contact form, go to Settings » General. At the bottom, click to enable reCAPTCHA.

WPForm Settings: add reCAPTCHA in Contact Forms

Once it’s enabled, don’t forget to save your form.

Adding a Contact Form with CAPTCHA

WPForms allow you to add your forms in various locations including your blog posts, pages, and your sidebar (widget-ready areas).

The most common way to add the form is with the post / page embed option. Start by creating a new post or page in WordPress and then click on the Add Form button there.

Embed Contact Form

Next, you need to select your contact form in the modal popup and click Add Form.

After that simply publish your page and view it.

Here’s a preview of what our WordPress contact form with reCAPTCHA look like:

published form with recaptcha

You are all set to prevent spam on your forms. We hope this article has helped you learn how to add reCAPTCHA in contact forms on your WordPress site.

Looking for more ways to keep your site safe? Here are a few other methods for building a spam-free contact form without CAPTCHA. You can also check out these 10 tips to prevent spam user registration.

If you liked this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Comments

    1. In most cases captchas aren’t needed as we include an anti-spam honeypot field by default, however in scenarios additional protection is required or helpful.

      In those situations we believe Google’s reCATPCHA is the best, though some users want more control over their captchas (Google offers basically none). This addon provides an alternate captcha method with more control.

  1. Thank you, helpful so far.

    What about Step 1: Client Side Integration

    and Step 2: Server Side Integration.

    Can you please explain if we need to do this copy/paste with the snipets, and if so, how?

    1. Hi Jason,

      We’ve got built-in integration with reCAPTCHA, so you don’t actually need to touch any code snippets at all to use it with our forms. As long as you grab the keys mentioned in this article, and then turn on reCAPTCHA for each specific form where you’d like it, you’ll be all set!

      I hope that helps 🙂

  2. I have a problem with reCAPTCHA, after i have inserted the data in the form and selected the reCAPTCHA, the form indicates that the box of the reCAPTCHA “This field is required” ?? Our web site: http://www.Makk.it

    1. Hi Michele,

      There are quite a few issues that can prevent Google’s reCAPTCHA from working properly, most of which have to do with theme issues or conflicts created by other plugins. It looks from your site’s source code like you may be using a plugin that pushes Javascript from various sources together — if you’re aware of a plugin like this, I’d recommend deactivating it, clearing any caches on your site and browser, and seeing if that does the trick.

      If that doesn’t work, please get in touch we can try to help you track down the issue 🙂

      1. Thanks Jess, problem solved. The plug-in that created problems was “WP deferred javaScript”.

    1. Hi Kat,

      I’m sorry to hear you ran into issues with this. When we see issues like what you’re describing, it’s usually because another plugin (or sometimes even the theme) is loading a duplicate set of reCAPTCHA code — which will break the captcha functionality and display an error like you described.

      The best way to check for a duplicate code source is to go through your plugins and look for anything that might have its own reCAPTCHA code loading, then to check theme settings to see if it could be coming from there.

      If you aren’t able to find where else reCAPTCHA might be loaded from, WPBeginner has a great tutorial on troubleshooting that would work well as an alternative.

      Or, if you’d prefer to avoid troubleshooting and go for a quick and simple solution, I’d suggest using WordPress Zero Spam. It doesn’t require any setup, isn’t visible in forms, and works really well.

      I hope that helps! If you have any questions, please get in touch 🙂

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.