Skip to content

Google reCAPTCHA: integrate with CF7 to eliminate spam

WordPress’s Contact Form 7 is often bombarded with many spam contact requests. However, we can integrate the CF7 form with free Google reCAPTCHA to eliminate the spam contact request to a significant extent. Room Google reCAPTCHA automatically detects spam submissions and prevents the form request from getting submitted.

Regarding fighting with spammers or spam contact requests, Google reCAPTCHA is a savior and does its job perfectly.

Thankfully, my WordPress blog, which uses Contact Form 7 for the contact us page, has an inbuilt integration feature with Google reCAPTCHA V3.

To complete integration, you must sign up for the API keys from Google reCAPTCHA and submit them in the CF7 plugin settings.

After integration, all your pain in managing the spam contact request will be gone forever. And there won’t be a bunch of contact emails every day asking to try the service or sharing explicit content links, and I don’t remember you winning a coca-cola lottery. 😉

Sign up Google reCAPTCHA v3 site and secret key

reCAPTCHA V3 is an advanced version of earlier reCAPTCHA versions, and it has been free since the beginning. We need a Google account to sign up for the site and secret keys.

  1. Head over to the Google reCAPTCHA website.
  2. Log in with your Google account to access the Admin console.
  3. Click to register a new site.
  4. Enter the label name and select the reCAPTCHA v3.
  5. Enter your blog URL or domain name address.
  6. Fill out the rest form with the correct details, including your email address.
    Google reCAPTCHA registration
  7. Submit the registration form.
  8. It will navigate you to a page where the site key and secret key applicable to your blog will be displayed.
    reCAPTCHA site key and secret key

You can always log in to see the Analytics of spam protection in the reCAPTCHA admin console. Also, there is no limit on the number of sites you can register for free and secret keys.

Integrating reCAPTCHA v3 with Contact Form 7

Copy those reCAPTCHA v3 site keys and secret keys into the CF7 setting. I assume you already have a contact form 7 and are working on your blog.

  1. Login to the blog WordPress dashboard.
  2. Navigate to the Contact tab.
  3. Select the Integration sub-menu.
  4. Entered the copied Site Key and Secret Key in their respective fields.
  5. Hit on the Save button.
Contact Form 7 integration with Google reCAPTCHA

That’s all. Contact Form 7 is now integrated with Google reCAPTCHA and protects your contact form from spam. There is no need to adjust the contact form template or add any element on the page; everything is handled backend.

There won’t be any CAPTCHA validation checkbox or image selection based on context like in reCAPTCHA Version 2.

Remove or hide the reCAPTCHA Banner

Immediately after integration, I noticed a small banner floating on the scroll on the right side of the blog. The annoying part was that the floating banner appeared all over the website. If it only appeared on the Contact page, I won’t mind, at least not all places.

When checking the blog on a mobile browser, hovering over the banner covers the site’s lower part. Hence, I thought of removing it from the blog and restricting it from loading on my contact page.

I have added a small code snippet in my function.php file that has removed the reCAPTCHA v3 banner. Below is the snippet on hiding, reading about code customizations, and removing the Google reCAPTCHA banner.

function restorebin_load_recaptcha_badge_page(){
if ( !is_page( array( 'contact') ) ) {
wp_dequeue_script('google-recaptcha');
}
}
add_action( 'wp_enqueue_scripts', 'restorebin_load_recaptcha_badge_page' );

Bottom Line: Google reCaptcha Spam

I integrated and set up Google reCAPTCHA with Contact Form 7 on my blog. I can proudly say it’s the best thing to happen against spam protection since it’s backed by Google spam protection technology; there is no need to worry about spam anymore.

Here is the screengrab of spam blocked on restoreBin for the last seven days after integration.

Google reCAPTCHA Analytics

Notable, isn’t it? This integration has eliminated the spam from Contact submissions and helped reduce the spam comments I received on the blog post.

F.A.Q: CF7 and Google reCAPTCHA integration

We have listed some of the frequently asked questions related to Contact Form 7 (CF7) and Google reCAPTCHA integration:

Is Google reCAPTCHA free for Contact Form 7?

Google reCAPTCHA is a free service provided by Google to fight against spam, and we can integrate it freely within the Contact Form 7 (CF7) on WordPress.

How to generate keys for Google reCAPTCHA integration with CF7?

We need to register our website on Google reCAPTCHA, which will generate the site and secret key required for CF7 integration.

How many websites can I add to Google reCAPTCHA spam protection?

There is no limit to how many sites you can register for Google reCAPTCHA; however, you need to register each website with a separate secret and site key.

Can we integrate Google reCAPTCHA with WordPress?

We can utilize the CF7 form to integrate Google reCAPTCHA with WordPress for contact form submissions.

Kushal Azza

Kushal Azza

Kushal Azza is a Google Certified IT Professional, Digital Content Creator, and Go-To Digital Marketer. He has over a decade of experience solving tech problems, troubleshooting, and creating digital solutions. Follow him on Twitter and LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *