Using Gravity Forms ‘gform_field_type_title’ PHP filter

The gform_field_type_title filter in Gravity Forms allows you to assign a custom title to a new field type.

Usage

add_filter('gform_field_type_title', 'assign_title', 10, 2);

Parameters

  • $title (string) – The title to be filtered. Defaults to the field type.
  • $field_type (string) – The field type to assign the title to.

More information

See Gravity Forms Docs: gform_field_type_title

Examples

Assign a title to a custom field type “map”

add_filter('gform_field_type_title', 'assign_title', 10, 2);

function assign_title($title, $field_type) {
    if ($field_type == 'map') {
        return 'Map';
    } else {
        return $title;
    }
}

Assign a title to a custom field type “video”

add_filter('gform_field_type_title', 'assign_title', 10, 2);

function assign_title($title, $field_type) {
    if ($field_type == 'video') {
        return 'Video';
    } else {
        return $title;
    }
}

Assign a title to a custom field type “rating”

add_filter('gform_field_type_title', 'assign_title', 10, 2);

function assign_title($title, $field_type) {
    if ($field_type == 'rating') {
        return 'Rating';
    } else {
        return $title;
    }
}

Assign a title to a custom field type “testimonial”

add_filter('gform_field_type_title', 'assign_title', 10, 2);

function assign_title($title, $field_type) {
    if ($field_type == 'testimonial') {
        return 'Testimonial';
    } else {
        return $title;
    }
}

Assign a title to a custom field type “file_upload”

add_filter('gform_field_type_title', 'assign_title', 10, 2);

function assign_title($title, $field_type) {
    if ($field_type == 'file_upload') {
        return 'File Upload';
    } else {
        return $title;
    }
}

Note: Place the code in the functions.php file of your active theme.