gform_address_display_format

Description

This filter can be used to change the way addresses are formatted.

Usage

add_filter( 'gform_address_display_format', 'change_address', 10, 2 );

Parameters

  • $formatstring

    The format to be filtered.

    Possible values: default and zip_before_city.

    • default

      Addresses are formatted in the following order: Street, Street2, City, State, Zip Code, Country.

    • zip_before_city

      Addresses are formatted in the following order: Street, Street2, Zip, City, State, Country.

  • $field Field Object

    The current field.

Examples

This example demonstrates how to change the address format to zip_before_city.

add_filter( 'gform_address_display_format', 'address_format', 10, 2 );
function address_format( $format, $field ) {
return 'zip_before_city';
}

Since

This filter was added in Gravity Forms version 1.5.28.
Added $field parameter in 1.9.2.

Source Code

This filter is located in the following methods in includes/fields/class-gf-field-address.php:

  • GF_Field_Address::get_field_input()
  • GF_Field_Address::get_value_entry_detail()