Turn On the Gravity Forms Honeypot for Every Form
Switches on Gravity Forms' built-in anti-spam honeypot for all forms, including ones created later, so nobody has to remember the setting.
Opens WPIDE on
Code
$wpide_gf_honeypot_skip = array(); // Form IDs to leave alone.
add_filter( 'gform_form_post_get_meta', function ( $form ) use ( $wpide_gf_honeypot_skip ) {
if ( is_array( $form ) && ! in_array( (int) rgar( $form, 'id' ), array_map( 'intval', $wpide_gf_honeypot_skip ), true ) ) {
$form['enableHoneypot'] = true;
}
return $form;
} );
Notes
Exclude a form by adding its ID to the list at the top.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.