Skip to content

Instantly share code, notes, and snippets.

@sblomberg
Last active March 16, 2017 18:32
Show Gist options
  • Save sblomberg/fe441a196ba57ef9854102b667000e36 to your computer and use it in GitHub Desktop.
Save sblomberg/fe441a196ba57ef9854102b667000e36 to your computer and use it in GitHub Desktop.
Enable Gravity Forms honeypot by default
<?php
class Gravity_Forms_Customizations {
public static function init() {
add_action( 'gform_after_save_form', array( __CLASS__, 'enable_honeypot_on_new_form_creation' ), 10, 2 );
}
public static function enable_honeypot_on_new_form_creation( $form, $is_new ) {
if ( $is_new ) {
$form['enableHoneypot'] = true;
\GFAPI::update_form( $form );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment