Description
The gform_default_address_type filter can be used to override the default address type for new fields. It can be used together with the gform_address_types filter to add support for new country specific address types.
Usage
The base filter which would run for all forms would be used like so:
add_filter( 'gform_default_address_type', 'your_function_name', 10, 2 );
To target a specific form append the form id to the hook name. (format: gform_default_address_type_FORMID)
add_filter( 'gform_default_address_type_5', 'your_function_name', 10, 2 );
Parameters
Examples
Australia
This example shows how the default address type can be set to Australia. The Australian address type would need to have been added by the gform_address_types filter.
add_filter( 'gform_default_address_type', function ( $default_address_type, $form_id ) { return 'australia'; }, 10, 2 );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 2.0.3.2.
Source Code
This filter is located in GF_Field_Address::get_default_address_type() in includes/fields/class-gf-field-address.php.