Description
Use this filter to change the default “Click to select…” placeholder text on Multi Select fields that use the enhanced user interface.
Usage
add_filter( 'gform_multiselect_placeholder', 'your_function_name', 10, 2 );
To target a specific form append the form id to the hook name. (format: gform_multiselect_placeholder_FORMID)
add_filter( 'gform_multiselect_placeholder_6', 'your_function_name', 10, 2 );
From 1.9.13.19 you can also target a specific field by appending both the form id and the field id to the hook name. (format: gform_multiselect_placeholder_FORMID_FIELDID)
add_filter( 'gform_multiselect_placeholder_6_3', 'your_function_name', 10, 2 );
Parameters
- $placeholder string
The placeholder to be filtered.
-
$form_id integer
ID of current form.
-
$field Field Object
The field currently being rendered. Available from 1.9.13.19.
Examples
This example changes the placeholder text to “Click to select your options…”
add_filter( 'gform_multiselect_placeholder_185', 'set_multiselect_placeholder', 10, 2 ); function set_multiselect_placeholder( $placeholder, $form_id ) { return 'Click to select your options...'; }
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_Field_MultiSelect::get_field_input() in includes/fields/class-gf-field-multiselect.php.