The gform_merge_tag_list_exclude filter allows you to exclude certain field types from the merge tag drop-downs in Gravity Forms admin pages.
Usage
add_filter('gform_merge_tag_list_exclude', 'exclude_hidden', 10, 3); // your custom code here return $excluded_fields;
Parameters
- $excluded_fields (array): A list of field types to be excluded from the merge tag drop-down.
- $element_id (string): The HTML ID attribute of the merge tag drop-down.
- $fields (array): An array containing all form Field Objects.
More information
See Gravity Forms Docs: gform_merge_tag_list_exclude
Examples
Exclude hidden fields from merge tag drop-down
add_filter('gform_merge_tag_list_exclude', 'exclude_hidden', 10, 3); function exclude_hidden($excluded_fields, $element_id, $fields) { // Exclude hidden fields from merge tag drop-down $excluded_fields[] = 'hidden'; return $excluded_fields; }
Exclude list fields from merge tag drop-down
add_filter('gform_merge_tag_list_exclude', 'exclude_list', 10, 3); function exclude_list($excluded_fields, $element_id, $fields) { // Exclude list fields from merge tag drop-down $excluded_fields[] = 'list'; return $excluded_fields; }
Exclude name fields from merge tag drop-down
add_filter('gform_merge_tag_list_exclude', 'exclude_name', 10, 3); function exclude_name($excluded_fields, $element_id, $fields) { // Exclude name fields from merge tag drop-down $excluded_fields[] = 'name'; return $excluded_fields; }
Exclude email fields from merge tag drop-down
add_filter('gform_merge_tag_list_exclude', 'exclude_email', 10, 3); function exclude_email($excluded_fields, $element_id, $fields) { // Exclude email fields from merge tag drop-down $excluded_fields[] = 'email'; return $excluded_fields; }
Exclude multiple field types from merge tag drop-down
add_filter('gform_merge_tag_list_exclude', 'exclude_multiple', 10, 3); function exclude_multiple($excluded_fields, $element_id, $fields) { // Exclude multiple field types from merge tag drop-down $excluded_fields[] = 'name'; $excluded_fields[] = 'email'; $excluded_fields[] = 'hidden'; return $excluded_fields; }