Start your new blog today
Subscribe and get your FREE Blogging Blastoff Email Course
Get The FREE course

How To Use Akismet With Contact Form 7

5 minute read

WordPress Tutorials

Disclosure: This article contains affiliate links. When you click these links and make a purchase, I may get a small commission. It won’t cost you anything, but it helps me to run this site.  Find out more.

Do you have a problem with spammers attacking your website’s contact form? In today’s tutorial, I am going to teach you how to use Akismet with Contact form 7 to prevent spam from arriving in your inbox.

Akismet is a spam filtering tool made by the creators of WordPress. Akismet’s primary task is to rid your comments of spam which are usually submitted automatically by spambots.

As well as dealing with comment spam Akismet can also be used to filter text entered into a contact form.

Contact Form 7 is one of the most popular contact form plugins. Fortunately, you can quite easily configure it to communicate with Akismet and rid your contact form submissions of spam as well as your comments.

If you are unfamiliar with Contact Form 7, it is a free plugin available in the WordPress repository. It is one of the most popular contact form plugins with more than five million active installations.

Why use Akismet with Contact Form 7?

We now know that Akismet is a spam filtering service, and Contact Form 7 is a WordPress plugin that can allow you to embed a contact form on your WordPress site.

When you put anything on your site where the public can submit text, then you open up your website to spammers

Adding a captcha is one way to deal with spam. A captcha is a way of forcing users to prove they are human by asking them to decipher some text. The latest captchas (Recaptcha v3 by Google), can detect if the user is not behaving like a human, and ask them to complete a task to prove their humanity.

The problem with captchas is that they can put off your users from completing a contact form, plus some captchas can slow down your website.

Akismet does not slow down your website loading time, and it doesn’t annoy anyone. It’s effective at stopping spam, plus, it’s free to use for non-commercial sites. The paid plans are quite reasonable.

How to Use Akismet with Contact Form 7

Why use Akismet with Contact Form 7?

If you don’t already have Akismet and Contact Form 7 installed on your WordPress site, go to Plugins->Add New and search for Akismet and then Contact Form 7. If you are not sure how to install plugins in WordPress, see this guide.

How to Use Akismet with Contact Form 7

Before you can use Akismet, you need to go through a process of registering with the service.

After you activate the plugin, you should see this message at the top of the plugins screen.

Setup your akismet account message

If you don’t see the above message click the settings link on the plugins screen instead:

Akismet spam settings link

If you already have an API key enter it on the next screen, otherwise, click ‘Get your API key‘ to go to the Akismet site to create your keys.

You must have a wordpress.com account to create Akismet keys. If you already have an account, login or sign up for a new one.

Akismet spam settings screen

Once you have logged into Akismet with your wordpress.com account, the next step is to select a plan.

One of the options is Name Your Price, where you can choose how much you would like to pay, the lowest price is zero. The free plan is meant only for non-commercial sites.

Select akismet plan

When you have selected a plan, the activation screen should display as below.

Akismet activate this site screen

Click Activate this site, then you should arrive back at your WordPress settings screen, and the Akismet key should be filled in.

You can then make some option changes to the settings.

I recommend you select the first option for ‘Strictness‘ – ‘Silently discard the most pervasive spam‘, and the first option again for ‘Privacy‘ – ‘Display a privacy notice‘.

Then save your changes.

Akismet complete settings screen

Frequently asked questions on how to use Akismet with Contact Form 7

If you don’t already have a contact form set up, create one now by going to Contact->Add New. Or you can start with the default form that is added when you install the plugin (Contact form 1).

Final thoughts on how to use Akismet and Contact Form 7

To connect Akismet and Contact Form 7, open up your form and add the text akismet: (including the colon) in front of one of the field names.

For example, if you have a field called your-name replace the text with akismet:your-name.

You only need to do this on one field, and in so doing the plugin, will filter the whole contact form data through Akismet when the user clicks the submit button.

Here is an example:

Akismet and contact form 7 integration

Step 1 – Install Akismet and Contact Form 7 plugins

The last step is to test it is working, and you can do that by entering some spammy text into the form.

Open up the page where you embedded the contact form.

If you don’t have it working anywhere yet, you will need to add the shortcode to a page, as listed at the top of the configuration screen for your form. It will be something like [contact-form-7 id=”xxx”].

Before you do this test, it is a good idea to test the form works normally first. Check you can enter valid data and get a success message back when you click the submit button.

Assuming all was well, we can now test with some spam text.

Type something spammy into any of the text fields such as in name field or message field. An example of some spam text is viagra-test-123.

Submit the form, and you should get an error message back, this indicates that the message was thrown out by the Akismet filter.

Frequently asked questions on how to use Akismet with Contact Form 7

Step 2 – Setup Akismet

Antispam Bee is an excellent alternative to Akismet. It is free and straightforward to set up. However, it doesn’t work with Contact Form 7. You would need to use a recaptcha or a honeypot to catch spam on your forms instead.

Final thoughts on how to use Akismet and Contact Form 7

Setting up Akismet with Contact Form 7 is a straightforward task. The task would be even easier if it were just a case of ticking a checkbox or have it automatically detect that Akismet is running. Nevertheless connecting Akismet and Contact Form 7 isn’t difficult to achieve.

On the whole, Akismet is a pretty accurate service, but it can never be 100% right.

The developers of Contact Form 7 recommend that you also install a plugin called Flamingo to collect the form data. That way, you can keep an eye on what messages arrive in spam, and it should help you pick up any false positives or negatives.

Do you have any questions on how to use Akismet and Contact Form 7? Please ask below.

This post was proofread by Grammarly

Related posts

Did you love this article? Please share it if you did!