Anti-spam honeypots are perhaps the best way to guard your forms from spam submissions. By default Gravity Forms does not add a honeypot to your form; you have to check the appropriate box on the Forms Settings page. However, if you want to enforce anti-spam honeypots on all Gravity forms then you can add this simple snippet. Warning: this function overrides the anti-spam checkbox setting for all your forms.

<?php
/**
* Enforce anti-spam honeypot on all Gravity forms.
*
* @param array $form
*
* @return array $form
*/
add_filter( 'gform_form_post_get_meta', function ( $form ) {
$form['enableHoneypot'] = true;
return $form;
} );
view raw functions.php hosted with ❤ by GitHub

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *