Enforce Gravity Forms Anti-Spam Honeypot

Gravity Forms includes a featured to add a hidden “honeypot” field to prevent spam, but it needs to be enabled manually for every form. Adding this snippet will enable it for all forms.

add_filter( 'gform_form_post_get_meta', __NAMESPACE__ . '\\enforce_gravity_forms_anti_spam_honeypot' );
* Enforce anti-spam honeypot on all Gravity forms.
* @param array $form The current form to be filtered.
* @return array
function enforce_gravity_forms_anti_spam_honeypot( $form ): array {
$form['enableHoneypot'] = true;
return $form;
view raw functions.php hosted with ❤ by GitHub

Credit to Tim Jensen, https://www.timjensen.us/enforce-anti-spam-honeypots-on-gravity-forms/

Reader Interactions

Leave a Reply

Your email address will not be published.