Using Gravity Forms ‘gform_list_field_parameter_delimiter’ PHP filter

The gform_list_field_parameter_delimiter filter allows you to modify the delimiter used to parse List field URL parameters in Gravity Forms.

Usage

To apply this filter to all forms, use the following code:

add_filter('gform_list_field_parameter_delimiter', 'your_function_name', 10, 4);

Parameters

  • $delimiter (string): Defaults to ‘|’.
  • $field (Field Object): The GF_Field object for the current field.
  • $name (string): The name of the current dynamic population parameter.
  • $field_values (array): An array of values provided for pre-population into the form.

More information

See Gravity Forms Docs: gform_list_field_parameter_delimiter

Examples

Change delimiter to double pipe

Modify the delimiter to use ‘||’ instead of ‘|’:

add_filter('gform_list_field_parameter_delimiter', function($delimiter, $field, $name, $field_values) {
    return '||';
}, 10, 4);

Change delimiter to comma for a specific form

Modify the delimiter to use ‘,’ for form with ID 5:

add_filter('gform_list_field_parameter_delimiter', function($delimiter, $field, $name, $field_values) {
    if ($field->formId == 5) {
        return ',';
    }
    return $delimiter;
}, 10, 4);

Change delimiter based on field type

Modify the delimiter to use ‘:’ for fields of type ‘checkbox’:

add_filter('gform_list_field_parameter_delimiter', function($delimiter, $field, $name, $field_values) {
    if ($field->type == 'checkbox') {
        return ':';
    }
    return $delimiter;
}, 10, 4);

Change delimiter based on dynamic population parameter name

Modify the delimiter to use ‘-‘ for dynamic population parameters starting with ‘custom_’:

add_filter('gform_list_field_parameter_delimiter', function($delimiter, $field, $name, $field_values) {
    if (strpos($name, 'custom_') === 0) {
        return '-';
    }
    return $delimiter;
}, 10, 4);

Change delimiter for a specific field in a specific form

Modify the delimiter to use ‘;’ for field with ID 3 in form with ID 7:

add_filter('gform_list_field_parameter_delimiter', function($delimiter, $field, $name, $field_values) {
    if ($field->formId == 7 && $field->id == 3) {
        return ';';
    }
    return $delimiter;
}, 10, 4);