Contact form 7 is the most popular plugin for enabling contact form on WordPress websites. Site owners are always faced with the issue of dealing with spam emails. Spam emails are unwanted messages that are being forced on a receiver who would not otherwise choose to receive such mail. Thanks to the developer of contact form 7 for integrating Google reCaptcha to enable anti-spam protection for our WordPress forms.
So, let’s get started on how to create anti-spam protection for our contact forms by adding Google reCaptcha to protect us from bots sending spam messages via the contact form
The integration is very easy once you already installed the contact form 7 plugin (if you don’t have contact form 7 already, proceed to STEP 1) then you will need a google reCaptcha account (this is easy so far you have a Google/Gmail account since reCaptcha is one of Google’s product and you can access all of their products with a single account)
STEP #1: You will need to install the contact form 7 plugin via your WordPress admin dashboard
- Go to Plugins > Add new and search for “Contact Form 7”.
- Click “Install Now” and activate the plugin.
Congratulations, the plugin is ready to use
STEP 2: Register your site with Google reCaptcha
Head over to https://www.google.com/recaptcha/admin to register your site with Recaptcha and generate keys for your domain (you need google account to gain access)
- Label: Enter label for your site, this can be your domain name or name of the contact page, just make sure you enter something in the field
- Choose the type of reCAPTCHA: Select reCAPTCHA V2 (the first option)
Something like the image below will pop down
- Enter your domain name(s) in the “Domains” field
- Check the reCAPTCHA terms of service
- You can uncheck “send alerts to owners” to be free from alert messages
- Then click the “Register” button to proceed
On the next page is the keys we need for integration to contact form 7, see image below
- Copy the SITE KEY and the SECRET KEY, now we are ready to integrate reCaptcha
STEP 3: Head back to your WordPress admin dashboard
- Navigate to Contact > Integration
- Click on the “CONFIGURE KEYS” button
- Enter the “SITE KEY” and “SECRET KEY” we copied from reCaptcha page to their specific fields.
- Then, click “SAVE”
STEP 4: To enable the reCaptcha on your contact forms
- Go to Contact > Contact forms > Your form
- Paste the shortcode in your form content just before the submit button to render the reCaptcha field
- Save the contact form.
Check your contact form page to confirm the reCaptcha has been added (just like the image below).
There are some other plugins that you can make use of as well, you can check them out via the link below