HTML.form.guide

How to add reCaptcha 2 to Contact Form 7 (updated 2019)

captcha contact form 7 contact form 7 recaptcha recaptcha recaptcha 2

CAPTCHA is an acronym for “completely automated public Turing test to tell computers and humans apart.”. If you post a form on your website, you will most probably start getting spam posts through your form. This is because there are “bots” (these are just scripts that just scrape through websites) that are coded to keep traversing the internet looking for forms to submit. Since you always read form submissions from your form, the spammers get to send you marketing messages easily.

xkcd on captcha

CAPTCHA makes it difficult for those automated scripts to submit the form. However, CAPTCHA is not the only solution. More about CAPTCHA alternatives later.

reCaptcha solution

reCaptcha is a great “bot” detection solution from Google. Google watches the pattern of user interaction to decide whether it is a “bot” or a real user. It is near impossible for a “bot” to simulate those patterns. So reCaptcha succeeds in blocking spam most of the time.

Versions of reCaptcha

reCaptcha version 1

reCaptcha version 1 used to show a couple of words in an image and the user had to enter the words in a box to prove they are not “bots”.

image source

reCaptcha version 2

The reCaptcha version 2 is simple and user-friendly. The user is to check a box saying “I am not a robot”. However, sometimes, this version of the captcha also throws some picture puzzles too. It generally depends on how the algorithms of Google feels like the user’s session is. Most of the time, genuine users get to complete the Captcha just by a checkbox.

reCaptcha version 3

Version 3 of reCaptcha is a JavaScript API that returns a score that indicates whether Google thinks this is a “bot” or not. There is no user interaction required.

Contact Form 7 reCaptcha support

Contact Form 7 version 5.1 and later uses reCaptcha 3. It does not support reCaptcha version 2 anymore. However, you can use reCaptcha 2 with even the latest Contact Form 7 using another plugin. A section below explains how to use reCaptcha 2 with Contact Form 7 latest versions. Before that, let me show you how to register for reCpatcha and how to insert reCaptcha in your websites.

Registering at reCaptcha site

Go to the reCaptcha Site. Then enter your details and complete the form.

recaptcha registration

Once you complete the form, it will give you a site key and a secret key. Copy it and safe keep those keys.

Using reCaptcha 2 in newer versions of Contact form 7

In order to use version 2 of reCaptcha in Contact form 7, install yet another Wordpress plugin: Contact form 7 -reCaptcha 2:

Configuring Contact Form 7 for reCaptcha

contact-form-7-recaptcha-setup

  • Go to the menu item Contact → Integrations.
  • Under reCaptcha, press “setup integration” and then enter the keys you had got from reCaptcha website.

reCaptcha is configured now. You can use this shortcode: [recaptcha] in your Contact form 7 setup. contact-form-7-form-setup

Copy the contact form 7 shortcode to your page and then try a preview. It should show the reCaptcha contact-form-7-in-wp-page

See the preview:

reCaptcha-in-wordpress

See Also