Gravity Forms Blocklist

Validate a field’s value against the WordPress Disallowed Comment Keys validation.

What does it do?

This plugin allows you to validate a field’s value against the WordPress Disallowed Comment Keys validation. This option can be set for a single field, multiple fields, all fields within a form. If the field fails validation it will display an error to the end user stating that their field contains disallowed words.

Features

  • Validate fields against Disallowed Comment Keys.
    Prevent form submissions that include blocked words, phrases, or IPs.
  • Validate against a single field, multiple fields, or all fields.
    Flexible validation to match your form’s needs.
  • Integrates with the built-in WordPress Disallowed Comment Keys.
    Use the same blocklist for both comments and forms.
  • Reject submissions silently with a honeypot.
    Reject entries without notifying the user that their entry has been blocked.
  • Automatic updates.
    Get updates and the latest features right in your dashboard.
  • Awesome support.
    We’re here to help! And we mean it.

How do I enable this functionality?

Since there are two options for this perk, field and form, we will do them in separate categories.

Single Field

To activate blocklist validation for a single field, navigate to the Perks tab and check Validate Against Disallowed Comment Keys.

Whole Form

To validate against every field on the form, navigate to the “Restrictions” section within the form settings area. Check Validate Against the WordPress Disallowed Comment Keys.

Usage Examples

Feature Details

Single Field

If a single field has the Blocklist setting enabled then that field will take the end-users submitted value and check it against that of the Disallowed Comment Keys words.

Whole Form

If the form wide Blocklist setting is enabled then it loops through all fields within the form when an end-user submits the form. It then checks the fields to see if they are supported by this perk. After grabbing a list of all supported fields it then validates the fields against the WordPress Disallowed Comment Keys words.

WordPress Disallowed Comment Keys

To specify blocked words, navigate to Settings > Discussion. Scroll down to “Disallowed Comment Keys” and enter any words you wish to prevent from being submitted on this form, one per line.

You can specify IP addresses in the Comment Keys and GF Blocklist will prevent submissions from that IP.

comment-blocklist-wp-setting
Block IP Ranges

In addition to blocking single IPs, you can block whole IP ranges using CIDR notation. GF Blocklist will block submissions from any IP address in the specified range.

Automate Blocklist Management

Save yourself time and beef up your blocklist by supplementing the list of keywords with this repository. You can add the list to your site by pasting it into the Disallowed Comment Keys, or you can use any of the supported plugins that automates adding new keywords.

Honeypot

Use the gpb_enable_honeypot hook to silently reject submissions while making it appear successful. This discourages spammers from attempting to find loopholes in your blocklist to exploit.


Known Limitations

Blocklist leverages wp_check_comment_disallowed_list() which results in a few Known Limitations:

  • It will match words inside of other words. So let’s say you wanted to ban the word Race it would also ban any words with race in it, like Racer.
  • We pass the visitor’s IP address and user agent into wp_check_comment_disallowed_list() to stay consistent with regular WordPress comment validation. This means if you include characters such as . in the disallowed key list, it will block any comment or entry due to IPs containing ..

Translations

You can use the free Loco Translate plugin to create translations for any of our Perks. If you’ve never used Loco translate before, here’s a tutorial written for beginners.

Developer’s Notes

This Perk was previously known as GF Comment Blacklist. We chose to rename it to match name changes in WordPress.

FAQs

How can I change the text of the validation error message?

You can change the text of the validation error by using the gpb_validation_message hook.

Hooks

Gravity Forms has hundreds of hooks. Check out our Gravity Forms Hook Reference for the most thorough guide to Gravity Forms’ many actions and filters.


Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.