Description
This function returns an array with all cities, from a specific country or province/state (when the state parameter is provided), containing a row id, a city name, state code and state name.
Usage
$cities = acfcs_get_cities( 'NL' );
If you provide the second parameter, the state code, results are limited to that particular state.
$cities = acfcs_get_cities( 'NL', 'NH' );
Returns
array {
'id' => string 'database row id',
'city_name' => string 'Amsterdam',
'state_code' => string 'NL-NH',
'state_name' => string 'Noord-Holland',
}
Arguments
- (string) - $country_code (required)
Country code (exactly 2 characters). - (bool) - $state_code (optional)
State code (min. 1 / max. 3 characters) | default false. - (bool) - $show_labels (optional)
Whether to show a text in the first option (used for dropdowns) | default false.
Defined in
inc/acfcs-functions.php - line 125
Used in
- fields/acf-city-selector-v4.php - line 160
- fields/acf-city-selector-v4.php - line 168
- fields/acf-city-selector-v5.php - line 133
- fields/acf-city-selector-v5.php - line 141
- inc/acfcs-ajax.php - line 119