Description
The “gform_checkbox_deselect_all_label” filter in Gravity Forms allows the “Deselect All” label for the Checkboxes field to be modified.
Usage
The following would apply to all forms:
add_filter( 'gform_checkbox_deselect_all_label', 'your_function_name', 10, 2 );
To target a specific form, append the form id to the hook name. (format: gform_checkbox_deselect_all_label_FORMID)
add_filter( 'gform_checkbox_deselect_all_label_1', 'your_function_name', 10, 2 );
To target a specific field for a form, append the form id and field id to the hook name. (format: gform_checkbox_deselect_all_label_FORMID_FIELDID)
add_filter( 'gform_checkbox_deselect_all_label_1_22', 'your_function_name', 10, 2 );
Parameters
- $select_label string
The “Select All” label.
-
$field Field Object
The field object for the current field.
Examples
1. All forms
add_filter( 'gform_checkbox_deselect_all_label', 'change_deselect_label', 10, 2 ); function change_deselect_label( $select_label, $field ){ return "My Custom Deselect All"; }
2. Specific form
add_filter( 'gform_checkbox_deselect_all_label_114', 'change_deselect_label', 10, 2 ); function change_deselect_label( $select_label, $field ){ return "My Custom Deselect All"; }
3. Specific checkbox field on a form
add_filter( 'gform_checkbox_deselect_all_label_114_2', 'change_deselect_label', 10, 2 ); function change_deselect_label( $select_label, $field ){ return "My Custom Deselect All"; }
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 2.3.
Source Code
This filter is located in GF_Field_Checkbox::get_checkbox_choices() in gravityforms/fields/includes/class-gf-field-checkbox.php.