gform_form_settings_initial_values

gform_form_settings_initial_values

DescriptionUsageParametersExamples1. Enable HoneypotPlacementSinceSource Code

Description

The filter gform_form_settings_initial_values allows the initial values that will be populated into the form settings to be overridden.

Usage

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

add_filter( 'gform_form_settings_initial_values', 'your_function_name', 10, 2 );

Parameters

$initial_values arrayAn associative array of setting names and their initial values.$form Form ObjectThe form currently being edited.

Examples

1. Enable Honeypot

add_filter( 'gform_form_settings_initial_values', function( $initial_values, $form ) {
$initial_values['enableHoneypot'] = true;

return $initial_values;
}, 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::get_initial_values() in form_settings.php.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註