Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save riskiii/bde1cddbb0e3424fcbf8d8271fbf0f34 to your computer and use it in GitHub Desktop.
Save riskiii/bde1cddbb0e3424fcbf8d8271fbf0f34 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