Using Gravity Forms ‘gform_address_street’ PHP action

The gform_address_street filter is used to modify the “Street” label in the Gravity Forms address field.

Usage

To apply the filter to all forms:

add_filter('gform_address_street', 'change_address_street', 10, 2);

To apply the filter to a specific form, use the form ID (e.g., form ID 5):

add_filter('gform_address_street_5', 'change_address_street', 10, 2);

Parameters

  • $label (string): The label to be filtered.
  • $form_id (integer): The current form’s ID.

More information

See Gravity Forms Docs: gform_address_street

Examples

Change the default address street label

add_filter('gform_address_street', 'change_address_street', 10, 2);

function change_address_street($label, $form_id) {
    // Change the address street label
    return "Address Street";
}

Change the street label for a specific form

add_filter('gform_address_street_5', 'change_address_street', 10, 2);

function change_address_street($label, $form_id) {
    // Change the address street label for form ID 5
    return "Street Address";
}

Change the street label based on form ID

add_filter('gform_address_street', 'change_address_street', 10, 2);

function change_address_street($label, $form_id) {
    // Change the address street label based on the form ID
    if ($form_id == 5) {
        return "Street Address";
    } else {
        return "Address Street";
    }
}

Change the street label to include extra information

add_filter('gform_address_street', 'change_address_street', 10, 2);

function change_address_street($label, $form_id) {
    // Add extra information to the street label
    return "Street Address (include apartment number if applicable)";
}

Change the street label to another language

add_filter('gform_address_street', 'change_address_street', 10, 2);

function change_address_street($label, $form_id) {
    // Change the street label to another language (e.g., Spanish)
    return "Calle";
}