The gform_checkbox_select_all_label Gravity Forms PHP filter allows you to modify the “Select All” label for the Checkboxes field.
Usage
To apply the filter to all forms:
add_filter('gform_checkbox_select_all_label', 'your_function_name', 10, 2);
To target a specific form, append the form ID to the hook name (format: gform_checkbox_select_all_label_FORMID):
add_filter('gform_checkbox_select_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_select_all_label_FORMID_FIELDID):
add_filter('gform_checkbox_select_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.
More information
See Gravity Forms Docs: gform_checkbox_select_all_label
Examples
All forms
Change the “Select All” label for all forms:
add_filter('gform_checkbox_select_all_label', 'change_label', 10, 2);
function change_label($select_label, $field) {
return "My Custom Select All";
}
Specific form
Change the “Select All” label for form with ID 114:
add_filter('gform_checkbox_select_all_label_114', 'change_label', 10, 2);
function change_label($select_label, $field) {
return "My Custom Select All";
}
Specific checkbox field on a form
Change the “Select All” label for checkbox field with ID 2 on form with ID 114:
add_filter('gform_checkbox_select_all_label_114_2', 'change_label', 10, 2);
function change_label($select_label, $field) {
return "My Custom Select All";
}
Based on field label
Change the “Select All” label based on the field label:
add_filter('gform_checkbox_select_all_label', 'change_label_based_on_field_label', 10, 2);
function change_label_based_on_field_label($select_label, $field) {
if ($field->label == "Interests") {
return "Select All Interests";
}
return $select_label;
}
Based on form and field IDs
Change the “Select All” label for checkbox field with ID 2 on form with ID 114, and for field with ID 3 on form with ID 115:
add_filter('gform_checkbox_select_all_label', 'change_label_based_on_form_and_field', 10, 2);
function change_label_based_on_form_and_field($select_label, $field) {
if ($field->formId == 114 && $field->id == 2) {
return "My Custom Select All for Form 114";
}
if ($field->formId == 115 && $field->id == 3) {
return "My Custom Select All for Form 115";
}
return $select_label;
}
Note: Place the code examples in the functions.php file of your active theme. The filter was added in Gravity Forms version 2.3.