The gform_form_settings_initial_values filter allows you to override the initial values that will be populated into the form settings.
Usage
To use the filter for all forms:
add_filter('gform_form_settings_initial_values', 'your_function_name', 10, 2);
Parameters
- $initial_values (array): An associative array of setting names and their initial values.
- $form (Form Object): The form currently being edited.
More information
See Gravity Forms Docs: gform_form_settings_initial_values
Examples
Enable Honeypot
Enable the honeypot feature for all forms by default:
add_filter('gform_form_settings_initial_values', function($initial_values, $form) { $initial_values['enableHoneypot'] = true; return $initial_values; }, 10, 2);
Note: Place this code in the functions.php
file of your active theme or a custom functions plugin.