Using Gravity Forms ‘gform_choices_setting_title’ PHP filter

The gform_choices_setting_title filter allows you to change the “Choices” settings title in the admin area for fields that have choices (drop down, radio button, checkboxes, multi select, product option).

On this pageJump to a section

Usage

add_filter('gform_choices_setting_title', 'change_title');

Parameters

  • $title (string): The current title of the “Choices” setting.

More information

See Gravity Forms Docs: gform_choices_setting_title

Examples

Change “Choices” title to “My Custom Title”

This code changes the title from “Choices” to “My Custom Title”.

add_filter('gform_choices_setting_title', 'change_title');

function change_title($title) {
    return 'My Custom Title';
}

Change “Choices” title based on form ID

This code changes the “Choices” title for form with ID 2 to “Custom Choices for Form 2”.

add_filter('gform_choices_setting_title', 'change_title_by_form_id', 10, 2);

function change_title_by_form_id($title, $form) {
    if ($form['id'] == 2) {
        return 'Custom Choices for Form 2';
    }
    return $title;
}

Change “Choices” title based on field type

This code changes the “Choices” title for checkbox fields to “Checkbox Choices”.

add_filter('gform_choices_setting_title', 'change_title_by_field_type', 10, 3);

function change_title_by_field_type($title, $form, $field) {
    if ($field['type'] == 'checkbox') {
        return 'Checkbox Choices';
    }
    return $title;
}

Change “Choices” title based on field label

This code changes the “Choices” title for fields with the label “Favorite Color” to “Color Options”.

add_filter('gform_choices_setting_title', 'change_title_by_field_label', 10, 3);

function change_title_by_field_label($title, $form, $field) {
    if ($field['label'] == 'Favorite Color') {
        return 'Color Options';
    }
    return $title;
}

Change “Choices” title for all fields to include the field label

This code changes the “Choices” title to include the field label for all fields.

add_filter('gform_choices_setting_title', 'change_title_to_include_label', 10, 3);

function change_title_to_include_label($title, $form, $field) {
    return $field['label'] . ' Choices';
}

Leave a Comment

Your email address will not be published. Required fields are marked *