The gform_confirmation_settings_fields filter allows you to modify the confirmation settings fields before they are displayed in Gravity Forms.
Usage
To apply the filter for all forms:
add_filter('gform_confirmation_settings_fields', 'your_function_name', 10, 3);
To target a specific form by adding the form ID after the hook name:
add_filter('gform_confirmation_settings_fields_6', 'your_function_name', 10, 3);
Parameters
- $fields (array): The confirmation settings fields. See the Settings API for details about how the fields are defined.
- $confirmation (Confirmation Object): The meta for the form confirmation being viewed/edited.
- $form (Form Object): The current form.
More information
See Gravity Forms Docs: gform_confirmation_settings_fields
Examples
Add a new field
This example demonstrates how to add a new hidden type setting:
add_filter('gform_confirmation_settings_fields', function($fields, $confirmation, $form) { $fields[0]['fields'][] = array('type' => 'hidden', 'name' => 'my_custom_hidden_field'); return $fields; }, 10, 3);
Place this code in the functions.php
file of your active theme or a custom functions plugin.
This filter was added in Gravity Forms v2.5.
The filter is located in \GF_Confirmation::settings_fields()
in includes/class-confirmation.php
.