Using Gravity Forms ‘gform_personal_data_identification_fields’ PHP filter

The gform_personal_data_identification_fields filter in Gravity Forms allows you to modify the list of personal data identification field choices.

Usage

To apply this filter to all forms:

add_filter('gform_personal_data_identification_fields', 'your_function_name', 10, 2);

To target a specific form, append the form ID to the hook name (format: gform_personal_data_identification_fields_FORMID):

add_filter('gform_personal_data_identification_fields_1', 'your_function_name', 10, 2);

Parameters

  • $identification_field_choices (array): An associative array with the field ID as the key and the field label as the value.
  • $form (Form Object): The current form.

More information

See Gravity Forms Docs: gform_personal_data_identification_fields

Examples

Add ‘Created By’ field as an identification field

This example adds the ‘Created By’ field as a choice for the identification field:

add_filter('gform_personal_data_identification_fields', 'add_fields', 10, 2);

function add_fields($identification_field_choices, $form) {
    $identification_field_choices['created_by'] = 'Created By';
    return $identification_field_choices;
}

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