### [Adding Spam Filters](https://wpforms.com/docs/adding-spam-filters/)

**Published:** March 12, 2024
**Author:** Umair Majeed

**Excerpt:** Learn how to add spam filters to improve WPForms spam protection.

**Content:**

Would you like to filter spam entries in your forms by blocking submissions from certain countries? Or perhaps you want to filter out submissions that contain prohibited words or phrases? WPForms includes customizable spam filters to help you prevent suspicious entries from being submitted.

In this tutorial, we’ll show you how to create country and keyword filters to prevent spam entries.

- [Accessing Spam Protection and Security Settings](#access-settings)
- [Adding a Country Filter](#country-filter)
- [Adding a Keyword Filter](#keyword-filter)
- [Frequently Asked Questions](#aioseo-frequently-asked-questions-64)

---

## Accessing Spam Protection and Security Settings

The spam filter options are located in the form builder’s Spam Protection and Security settings. To access them, create a new form or edit and existing one to open the form builder.

Then go to **Settings » Spam Protection and Security**.

![Spam protection and security settings](https://wpforms.com/wp-content/uploads/2022/10/spam-protection-settings.png)You’ll find the country and keyword filters under **Filtering**.

![The WPForms in-form spam protection and security settings panel](https://wpforms.com/wp-content/uploads/2022/11/spam-protection-and-security-settings-panel.png)## Adding a Country Filter

Using a country filter is a simple and effective way to allow or deny form submissions from specific countries.

To enable this feature from the form builder, head to **Settings » Security and Spam Protection** and toggle on the **Enable country filter** option.

![Enable country filter toggle](https://wpforms.com/wp-content/uploads/2022/11/enable-country-filter-toggle.png "Enable Country Filter Toggle")Next, click the dropdown menu under **Country Filter** and select **Allow** if you’d like to permit users from specific countries to submit your form. If you’d like to block users from specific countries from submitting your form, select **Deny**.

![Select allow or deny from dropdown](https://wpforms.com/wp-content/uploads/2022/11/select-allow-or-deny-from-dropdown.png "Select Allow or Deny From Dropdown")Then, click the other dropdown and select the countries you’d like to allow or deny entries from.

![Select countries from dropdown](https://wpforms.com/wp-content/uploads/2022/11/select-countries-from-dropdown.png "Select Countries From Dropdown")For our example, we’ll choose to **Allow** entries from **United States of America** only.

![Allow entries from usa](https://wpforms.com/wp-content/uploads/2022/11/allow-entries-from-usa.png "Allow Entries From USA")Now if a user attempts to submit our form from outside of our selected country, the form will fail to submit. They’ll also see a default message that reads, “Sorry, this form does not accept submissions from your country.”

![Country filter message](https://wpforms.com/wp-content/uploads/2023/02/unsupported-country.png "Country Filter Message")If you’d like to change the message shown to the denied user, you can add your custom message to the field under **Country Filter Message**.

![Custom country filter message](https://wpforms.com/wp-content/uploads/2022/11/custom-country-filter-message.png "Custom Country Filter Message")Once you’ve added a country filter, be sure to save your form to apply the changes.

**Note:** If the **Store spam entries in the database** option is enabled, submissions blocked by the country filter will still be accepted and stored in the **Spam** folder.

## Adding a Keyword Filter

Using a keyword filter is an easy way to manage inputs for all fields in your forms. To start, toggle the **Enable keyword filter** option to the on position.

![Enable keyword filter](https://wpforms.com/wp-content/uploads/2022/11/enable-keyword-filter.png "Enable Keyword Filter")Next, click **Edit keyword list** to open your list of keywords.

![Click edit keyword list](https://wpforms.com/wp-content/uploads/2022/11/click-edit-keyword-list.png "Click Edit Keyword List")You’ll then see a text box labeled **Keyword Filter List**. To add words or phrases to your list, simply type them in the text box. If you add more than one word or phrase, be sure to type each one on its own line.

![Add keywords and phrases](https://wpforms.com/wp-content/uploads/2022/11/add-keywords-and-phrases.png "Add Keywords and Phrases")**Note:** Because the keyword filter is case-insensitive, it doesn’t detect any difference between lowercase or uppercase letters.

If you use commas to separate the words or phrases in your keyword list instead of placing each on its own line, you’ll likely see a prompt to reformat your list. Reformatting your list helps the filter detect the specific words and phrases that you want to block in your forms.

If you wish to reformat, simply click the **Yes, Reformat** button.

![Click yes reformat button](https://wpforms.com/wp-content/uploads/2022/11/click-yes-reformat-button.png "Click Yes Reformat Button")After reformatting your list, the commas will be removed, and the words and phrases will appear on their own line. This can be particularly helpful if you’re copying a list from a CSV file since commas often separate CSV file values by default.

![Reformatted keyword list](https://wpforms.com/wp-content/uploads/2022/11/reformatted-keyword-list.png "Reformatted Keyword List")Once you’ve added your keywords, click **Save Changes** to update your list of blocked keywords.

![Click save changes button](https://wpforms.com/wp-content/uploads/2022/11/click-save-changes-button.png "Click Save Changes Button")**Note:** The words and phrases added to your Keyword Filter List will apply to all forms on your site that you’ve created with WPForms.

Now when a user attempts to submit your form with one of the blocked keywords, the form will fail to submit. The user will also see a default message that reads, “Sorry, your message can’t be submitted because it contains prohibited words.”

![Keyword filter message](https://wpforms.com/wp-content/uploads/2023/02/message-contains-prohibited-words.png "Keyword Filter Message")**Note:** If **Store spam entries in the database** is enabled, entries with blocked keywords are saved as spam and no message is shown. If it’s disabled, the submission is blocked and the Keyword Filter Message is displayed.

To change the message that’s displayed to the denied user, replace the text in the **Keyword Filter Message** field with your preferred message.

![Customize keyword filter message](https://wpforms.com/wp-content/uploads/2022/11/customize-keyword-filter-message.png "Customize Keyword Filter Message")Once you’ve set up your keyword filter, be sure to save your form.

**Note:** To further enhance your form’s security by preventing domain names from being submitted in text fields, see our [developer documentation](https://wpforms.com/developers/how-to-block-domains-from-your-text-fields/) for instructions on blocking specific domains.

## Frequently Asked Questions

Below, we’ve answered some of the top questions about adding spam filters.

#### Can I check for keywords before the user clicks Submit?

Yes. If you are comfortable with custom code, you can use our developer guide on [adding a real time keyword blocklist to a Single Line Text field](https://wpforms.com/developers/add-a-real-time-keyword-blocklist-to-a-single-line-text-field/) to run a keyword check when the user leaves a specific field.

![](https://wpforms.com/wp-content/uploads/2025/12/custom-keyword-filter-1024x740.png)The form will show an error and prevent submission at that point, while your standard keyword filters in **Settings » Spam Protection and Security** still run when the form is submitted.

That’s it! Now you know how to add spam filters to your forms in WPForms.

Next, want to learn about other spam protection options? Check out our [complete guide to WPForms spam protection](https://wpforms.com/docs/how-to-prevent-spam-in-wpforms/) for more details.

**Categories:** Functionality, Spam Prevention and Security

---

