formcierge_states_by_country
Filter
Since v1.0.0
Modify the list of states or provinces returned for a specific country when the Address or State field is used in country-aware mode.
Parameters
$states
array
Associative array of state code => name for the given country.
$country_code
string
ISO 3166-1 alpha-2 country code.
includes/Fields/StateField.php
Basic Usage
add_filter( 'formcierge_states_by_country', function ( $states, $country_code ) {
if ( $country_code === 'AU' ) {
$states['ACT'] = 'Australian Capital Territory';
}
return $states;
}, 10, 2 );