How to add Google reCAPTCHA in Contact Form 7

Contact Form 7 is one of the most popular contact form plugin available on the WordPress repository. Contact form helps your visitors to reach out to you quickly. Unfortunately, many users complain about receiving too many spam emails through the contact form. A study states that around 54 billion spam emails are sent every day. It is most likely that you might be receiving spam emails from your contact form too.

Thankfully, using reCAPTCHA, you can avoid spam emails from your contact form. reCAPTCHA protects you against spam and other types of automated abuse. As a result, you will only receive emails from real visitors.

In this tutorial, I’m will show you how you can add Google reCAPTCHA in Contact Form 7 to your WordPress site.

Adding Google reCAPTCHA in Contact Form 7

Contact Form 7 provides a seamless integration of reCAPTCHA. To begin, you need to install Contact Form 7 plugin.

Step 1: Install Contact Form 7 plugin

Follow the below steps to install the plugin:

  • Login to your WordPress site.
  • Go to Plugins > Add New > Search for “Contact Form 7”.
Installing Contact Form 7 plugin

Click on Install Now and then on Activate button.

At this point, the plugin is installed, and you are good to go. Here’s an in-depth tutorial on how to add Contact Form in WordPress site.

Step 2: Get the reCaptcha public and secret keys

To display reCAPTCHA, you need to get reCaptcha public and secret keys for your domain. Follow the given steps to get the reCaptcha keys:

Google reCAPTCHA homepage

Select reCAPTCHA v3 and fill the necessary details.

Registration for Google reCAPTCHA v3

After submission, you will get the Site Key and Secret Key. Copy them and store them safely.

Google reCAPTCHA v3 keys

Step 3: Integrate reCAPTCHA with Contact Form 7

Now that you have the required API keys, it’s time to integrate into Contact Form 7. To integrate it:

  • Go to Contact > Integration
  • Add the Site Key and Secret Key and click on Save Changes.
Integrating Google reCAPTCHA in Contact Form 7

That’s it. Now, if you visit your site, you will see the reCAPTCHA added on your website, something like this.

Google reCAPTCHA v3 on the WordPress site

reCAPTCHA v3 doesn’t need a CAPTCHA widget ( the ‘I’m not a robot’ checkbox) to work. The contact forms use reCAPTCHA’s score to verify whether the form submission is from a human or a spam bot.

In case you want to integrate reCAPTCHA v2 with ‘I’m not a robot’ checkbox, you refer to the instructions below.

Adding Google reCAPTCHA v2 in Contact Form 7 Plugin

To integrate reCAPTCHA v2, you need to register your site and choose reCAPTCHA v2. To do so, follow the below steps:

  • Go to the Google reCaptcha site.
  • Click on the Admin Console button at the top right corner.
  • Select reCAPTCHA v2, fill the necessary details and click on the Submit button.
Registration for Google reCAPTCHA v2

On the next screen, you will see the Site Key and Secret Key. Now, return to your WordPress dashboard and navigate to Contact > Integration > Add the API keys and click on Save Changes and then Setup Integration button.

Integrating Google reCAPTCHA in Contact Form 7

Now, to use reCAPTCHA v2, you need to install reCAPTCHA v2 for Contact Form 7 plugin.

To do so, go to Plugins > Add New > Search for “recaptcha v2”. Install and activate the plugin when you see in the search result.

Installing reCAPTCHA v2 plugin

Once the plugin is activated, go to Contact > reCaptcha Version. Choose reCaptcha Version 2 under reCaptcha Usage and under reCaptcha Source and hit on Submit.

Configuring reCaptcha v2 plugin

Now, you are almost done with one final step left to do, i.e. to add the reCAPTCHA widget. By default, contact form comes with necessary fields that include name, email address, subject, and message. To display the reCaptcha, you need to add the tag.

For this, navigate to Contact > Edit the contact form (which you want to use) and add [recaptcha] just above the submit button, as shown in the screenshot below.

Adding reCAPTCHA tag in Contact Form 7

Finally, click on the Save button to publish the changes and visit your Contact page. You will see your contact form with ‘I’m not a robot’ box like this:

Contact Page with Google reCAPTCHA v2

That’s it! You just learned how to add Google reCaptcha in Contact Form 7 on your WordPress site.

Final Thoughts

Every website owner should use the contact form to communicate with their customers or visitors. Besides, the contact form is helpful in receiving feedback and building trust with your readers. However, spambots often attack contact form to send unnecessary or spammy emails. That is when reCAPTCHA comes into play. It protects you against spam.

Have you added reCAPTCHA to your Contact form? Which one do you prefer, reCAPTCHA v2 or v3? Do let us know your opinion in the comment section below. If you face any issues or have any queries, please feel to share below.

Leave a Reply