Do you want to prevent bots from submitting your forms?
Form spam is a huge problem in WordPress. And when it happens, it can be a huge hassle to deal with.
Fortunately, there are a few highly effective ways you can fight spam and stop bots from filling out your forms.
In this article, we’ll discuss 3 of these tools, and show you how to set them up.
Why Do Bots Fill Out Contact Forms?
Bots fill out forms for several reasons like link spam, advertisement, attempting phishing scams, or looking for security vulnerabilities on your site.
Without protection, dangerous spambots may even cause an outage on your site or spread malware infections.
This makes it so important that you implement strong anti-spam measures on your WordPress forms.
How To Prevent Bots From Submitting Your Forms
Getting Started: Install WPForms and Create a New Form
To get started, you’re going to need a WPForms installation on your website. The other two methods we’ll be discussing in this article are compatible with any WPForms license, but you can only use Custom Captcha on WPForms paid plans.
So we’ll get started by installing WPForms Pro, our most popular paid license. If you need a little help with this step, take a look at this helpful guide to installing WordPress plugins for beginners.
Once you have installed and activated WPForms, we’ll need a new form. Creating a new form is really easy to do in WPForms. The plugin allows you to create a form from scratch using the drag-and-drop form builder, or to pick from 400+ prebuilt form templates to get started.
From the WordPress dashboard, you’ll see a WPForms tab in the left sidebar. Click on this, and then on Add New.
This will take you to the WPForms template library. You can choose a suitable template here or even build a form from scratch if you’d like to.
We’re going to choose the Simple Contact Form template for this guide.
This will open up the form builder with additional form fields on the panel on the left.
Give your form a name and save it by clicking the Save button at the top right corner of the page.
Now, you can head back into the WordPress admin area where we’ll set up WPForms’ Custom Captcha, before we return to our form.
Method #1: Use WPForms Custom Captcha
WPForms offers a Custom Captcha tool that allows you to set up custom math questions to filter human users from bots. Follow these steps to set it up:
Enable the Custom Captcha Addon
First, you’ll need to enable the Custom Captcha addon. This can be done with a single click. In the WordPress admin area, head over to WPForms » Addons.
Scroll down till you see the Custom Captcha addon, then click activate.
Now, we’ll return to the form we created and add a Custom Captcha field to it.
Add a Custom Captcha Field to Your Form
Back in the form builder, you can find the Custom Captcha field in the Fancy Fields section. Drag and drop the field onto your form, and that’s it!
The form will come with a maths challenge by default. But you can also customize this question. To do this, click on the Custom Captcha field, and then on the Advanced tab.
Scroll down to the section labeled Type and click on the field where it says Math.
This will open a dropdown with another option labelled Question and Answer.
When you click on this, you’ll see that you can set up a custom question and answer pairing. set this up with whatever question and answer you’d like to use, and you’ll be done here.
Embed the Form
Now, all that’s left to do is to embed your Custom Captcha-enabled form on a page and publish it. Go ahead and save the form, again, then click the Embed button right next to the Save button.
This will trigger a modal offering you the option of embedding your form on a new or existing page. For this guide, we’ll embed our form on a new page.
Give your new page a name;
Then simply publish it to make your form live.
As you can see, our form now has a Custom Captcha field with a math question.
Next, we’ll explore reCAPTCHA, showing you how to use it to protect your forms.
Method #2: Use Google reCAPTCHA
Google reCAPTCHA is the go-to tool for fighting form spam for millions of websites. Here’s how to set it up:
Create a reCAPTCHA Account
To use reCAPTCHA in WordPress, we’ll need to create a reCAPTCHA account and get a Secret Key and Site Key for your website.
To get started, log on to the reCAPTCHA admin console to register a new site and get these keys.
First, you’ll need to enter a Label. This is your domain name without the “https://www.”
Then you’ll need to choose a reCAPTCHA type. There are two broad types of reCAPTCHA to choose from:
reCAPTCHA v3 – This version of reCAPTCHA can evaluate user behavior and filter bot activity without having to interact with users on the page. It is quite powerful but also a little invasive, as it collects tons of user data.
reCAPTCHA v2 – This version of reCAPTCHA relies on the traditional challenge-based CAPTCHA. There are actually two types of reCAPTCHA v2.
There is the Checkbox CAPTCHA and the Invisible CAPTCHA. The Checkbox CAPTCHA requires users to simply tick a checkbox to prove they are human.
Invisible CAPTCHA, on the other hand, works in the background and only challenges users once it detects suspicious activity.
Not sure which is best for your site? We’ve got a comprehensive piece of documentation that covers this here: How to Choose a CAPTCHA in WPForms.
Once you’ve decided which version to use, tick the checkbox next to it.
For this guide, we’ll go with invisible reCAPTCHA v2. This reCAPTCHA type provides a good balance between fighting bots and offering a good user experience.
Something to keep in mind is that once a site key has been set up for a particular reCAPTCHA type, you can’t use it with a different reCAPTCHA version.
Next, enter the domain name where you’ll use the reCAPTCHA keys. You can enter multiple sites here. Just as before, enter the domain alone, and omit the “https//www.”
You’ll also need to accept the reCAPTCHA terms of service. Once you’ve done this, click Submit.
And you’ll have registered a new site!
You’ll now see your Site Key and Secret Key. Grab these and let’s head back into the WordPress admin dashboard.
Now, we’ll head into WPForms » Settings » CAPTCHA.
You’ll see that you’ll have a choice of hCaptcha, reCAPTCHA, or none. Choose reCAPTCHA to continue with the setup.
As we mentioned, there are different versions of reCAPTCHA to choose from. We’ve gotten a site key for invisible reCAPTCHA so that’s what we’ll choose in the WPForms settings.
Next, enter your Site Key and Secret Key, and remember to save these settings. That will be all for this stage.
In the next step, we’ll add a reCAPTCHA field to our form.
Add reCAPTCHA to a Form
If you tried the previous method, you’ll already have a form ready for use. To find it, click through WPForms » All Forms to get to the Forms Overview page.
Click on the form name to open it up in the form builder. If the form already had a WPForms Custom Captcha field, you’ll want to remove this to make way for the reCAPTCHA field.
Click on the form to open it in the form builder. We’ll then head into the standard fields section of the form builder and click on the reCAPTCHA field to enable it.
And that’s it.
In the form builder, you’ll now see that reCAPTCHA has been enabled.
Remember, we chose invisible CAPTCHA, so don’t expect to see the CAPTCHA field on the frontend, until it is triggered by suspicious behavior.
And that will be all for adding reCAPTCHA to a WordPress form.
We’ll now discuss using hCaptcha to prevent bots from filling your forms, and then we’ll wrap things up with some additional anti-spam tools.
Here we go!
Method #3: Use hCaptcha
hCaptcha is a popular alternative to Google reCAPTCHA.
Unlike reCAPTCHA, there’s only one version of hCaptcha, but you can adjust the difficulty levels of the image challenges to be displayed to users.
To use hCaptcha on your WordPress forms, first you’ll need a hCaptcha account. Here’s how to set one up:
Create a hCaptcha Account
To get started, navigate to the hCaptcha website and click Signup.
You’ll be given a range of plans to choose from.
We recommend choosing the free plan for companies or websites. This plan is labeled Add hCaptcha for Publishers to my website or app.
The next step would be to get your hCaptcha Site Key and Secret Key.
Get Your hCaptcha Site Key and Secret Key
hCaptcha will generate these for you. All you have to do is grab them and enter them correctly in the WPForms settings.
But first, there are a few steps to take in configuring your site key.
In the hCaptcha admin dashboard, click on Sites. You’ll see your site key on the new page.
Click on Settings.
The main thing you need to do here is to add your domain name to the Site Key.
In the section labeled Hostnames, paste in your domain name (again, don’t add the https://www), then click Add new domain.
There are a few other settings to play around with, such as the difficulty level, but none of these are essential.
For more details, check out our complete guide to setting up hCaptcha in WordPress. Now, we’ll head back into WordPress to set up WPForms with your hCaptcha Site Key and Secret Key.
Configure WPForms and hCaptcha
Back in the WordPress dashboard, click on WPForms from the left sidebar, then click Settings » CAPTCHA.
We’ve been here before, when we set up reCAPTCHA. This time we’ll choose hCaptcha.
Enter your Site Key and Secret Key and save these settings.
hCaptcha will now be ready for use with your WPForms forms. Next, we’ll show you how to add a hCaptcha field to a form.
Add a hCaptcha Field to Your Form
Back in the form builder, look for the hCaptcha field in the Standard Fields section. Just like before, we’ll first remove any other CAPTCHA type that we’ve added to our form.
To disable reCAPTCHA, simply click on the reCAPTCHA field back in the form builder, just as you did to enable it.
This is also true for hCaptcha. Go ahead and enable the hCaptcha field by clicking on it.
You won’t see a hCaptcha field appear on your form but you should see a notice in the top right corner of the form builder, showing that hCaptcha has been enabled.
You can now embed your form on a page on your website following the instructions we shared previously.
Here’s what your hCaptcha-enabled form looks like on the frontend:
And that’s it! We’ve shown you how to prevent bots from filling out your forms using 3 different CAPTCHA tools.
Wondering if there are other ways to fight form spam? We’ll discuss this next.
Bonus: Other Ways of Filtering Spam With WPForms
WPForms takes form spam very seriously which is why it supports various spam prevention methods.
You can use these extra form prevention tools along with the main methods mentioned above if you’d like to add an extra layer of security.
Akismet is the most widely-used spam-filtering tool for WordPress. It not only blocks comment spam, but it also integrates very well with top form builder plugins like WPForms.
All versions of WPForms (including Lite) come with a native Akismet integration that helps to filter bots. You can find this setting in the Spam Protection and Security section of the form builder.
Akismet uses its vast databases of known spam entries to filter spam when it’s entered into your forms. It can also analyze user behavior to distinguish between bots and real human users.
Anti-Spam Form Tokens
Another thing you can do is enable WPForms form tokens. This setting is also found in the Spam Protection and Security section of the form builder.
WPForms form tokens are cryptographic, time-sensitive strings that are submitted when real users submit a form. Bots aren’t able to detect or mimic WPForms anti-spam tokens effectively, so enabling these tokens is a smart anti-spam tactic.
And that’s it for our guide to preventing bots from filling your forms!
Next, Apply Web Form Design Best Practices
Looking to improve conversion on your site? Form design is crucial. Here’s all you need to know about effective form design, covered in our guide to web form design best practices.
And if you’re new to form-building, check out our guide to embedding a form on your website.
Ready to build your web form? Get started today with the easiest WordPress form builder plugin. WPForms Pro includes lots of free templates and offers a 14-day money-back guarantee.