Adding Google reCAPTCHA to WordPress Forms

Do you want to stop spam bots from filling out your form? You can add reCAPTCHA to your WordPress forms to protects against spam and other types of automated abuse.
Google reCAPTCHA is a program that judges whether a user is a human or a robot and stop the bots from being able to submit forms.
reCAPTCHA is of different types. However we only support the version 3 and 2 (“I’m not a robot” Checkbox) and you can only use one of them in all your forms.
reCAPTCHA v2 (“I’m not a robot” Checkbox)
This version requires the user to click a checkbox indicating the user is not a robot. This will either pass the user immediately (with No CAPTCHA) or challenge them to validate whether or not they are human.
reCAPTCHA v3
To avoid asking for user interaction, Google will monitor the user’s behaviour on your site to look for what it considers suspicious activity. Then, reCAPTCHA will assign them a score. You will decide the score needed to allow your forms to submit. If a user’s reCAPTCHA score does not meet your requirements, they will have no way to submit your form.
In this tutorial, we will learn how to integrate either of the Google reCAPTCHA version above to your MailOptin’s optin forms.
Generating reCAPTCHA Keys in Google
Go to the Google reCAPTCHA site. You will prompted to login if you aren’t.
Enter a label used to identify the site in the future, select the reCAPTCHA type, enter the domain name of your website and submit.
After registering, you should see a page with the keys for your website.
Saving the reCAPTCHA Keys in MailOptin
Log into your WordPress site and go to MailOptin » Settings. Then, click on the reCAPTCHA tab.
Select the reCAPTCHA type and enter your Site Key and Secret Key.
Click on the Save Changes button to store your settings.
Adding reCAPTCHA to a Form
Open the form you want to add reCAPTCHA to and go to the “Fields” panel.
Add a new field and select either reCAPTCHA v2 or reCAPTCHA v3 as the field type.
Finally, save the changes.
Preview the form on your site and you should see the reCAPTCHA shown (in the case of v2) or the badge at the bottom right corner (for v3).
La Fin!