Description
The gform_form_settings_fields filter is used to customize the available settings on the Form Settings page and save them to the database.
Usage
The filter which runs for all forms would be used like so:
add_filter( 'gform_form_settings_fields', 'your_function_name', 10, 2 );
You can also target a specific form by adding the form id after the hook name.
add_filter( 'gform_form_settings_fields_6', 'your_function_name', 10, 2 );
Parameters
-
$fields array
The Form Settings fields. See the Settings API for details about how the fields are defined.
-
$form Form Object
The current form.
Examples
Add a new field
This example would add a hidden field to the Form Options section of the Form Settings page.
add_filter( 'gform_form_settings_fields', function ( $fields, $form ) {
$fields['form_options']['fields'][] = array( 'type' => 'hidden', 'name' => 'my_custom_hidden_field' );
return $fields;
}, 10, 2 );
Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This filter was added in Gravity Forms v2.5.
Source Code
This filter is located in GFFormSettings::form_settings_fields() in form_settings.php.