Skip to content

Use the WordPress Comment Blacklist to validate the fields in a Gravity Form

Notifications You must be signed in to change notification settings

adaprile/Gravity-Forms-WP-Comment-Blacklist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Gravity Forms Blacklist

This filter was created to help combat SPAM for the WP Gravity Forms Plugin. It will use the WordPress Disallowed Comment Keys to validate the fields in a Gravity Form. If a field value contains any of the words in the blacklist, validation will fail and the form will not be submitted.

How to Use

  • Add the filter to your WordPress theme's 'functions.php' file.

  • In your WordPress dashboard go to 'Settings > Discussion > Disallowed Comment Keys' (formerly known as 'Comment Blacklist' and 'Comment Blocklist' in WP versions < 5.5). Add the words you would like blacklisted, one per line.

    • You can use the primitive list I provided in this repository, or consider using Wordpress Comment Blacklist by splorp - This is a regularly updated blacklist with over 45,000 entries.
  • That's all! Now when a field value contains a match to any of the lines in the blacklist, the form submission will fail.

Extra Notes

BE CAREFUL! It is very easy to add things to the blacklist that could accidentally block legitimate form submissions. Here's a great article explaining this.

This filter will apply the blacklist validation for all fields in a Gravity Form.

You can customize the validation message by editing line 31. I have it set to 'This field contains bad words!'.

More Documentation

Author

  • Anthony D'Aprile - Ney

Acknowledgments

PurpleBooth - Thanks for the awesome README Template.

About

Use the WordPress Comment Blacklist to validate the fields in a Gravity Form

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages