gform_confirmation_settings_fields

Description

The gform_confirmation_settings_fields filter allows the confirmation settings fields to be modified before they are displayed.

Usage

The filter which would run for all forms would be used like so:

add_filter( 'gform_confirmation_settings_fields', 'your_function_name', 10, 3 );

You can also 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.

Examples

1. Add a new field

This example shows 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 );

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 \GF_Confirmation::settings_fields() in includes/class-confirmation.php.