gform_merge_tag_list_exclude

Description

The gform_merge_tag_list_exclude filter allows developers to exclude field types from the merge tag drop-downs that are displayed throughout the admin pages.

Usage

add_filter( 'gform_merge_tag_list_exclude', 'exclude_hidden', 10, 3 );

Parameters

ParameterTypeDescription
$excluded_fieldsarrayArray to be filtered. Contains a list of field types that will be excluded from the merge tag drop down.
$element_idstringHTML ID attribute of the merge tag drop-down.
$fieldsarrayArray containing all form Field Object.

Examples

Exclude file upload fields from the merge tag list.

add_filter( 'gform_merge_tag_list_exclude', 'exclude_hidden', 10, 3 );
function exclude_hidden( $excluded_fields, $element_id, $fields ) {
	$excluded_fields[] = 'fileupload';
	return $excluded_fields;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in GFCommon::insert_variables() in common.php.