Filter
rpress_get_state_name
On this page
Filters the state name returned for a state code.
Applied at the end of rpress_get_state_name(). The function looks the state code up in rpress_get_states() for the given country and falls back to the code itself when no match is found. Note that the country code is not passed to the filter.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$state_name | string | The resolved state name, or the state code if it was not found. |
$state_code | string | The state code that was requested. |
Return value#
string. The state name to return.
Example#
function my_state_name( $state_name, $state_code ) {
if ( 'NY' === $state_code ) {
return 'New York State';
}
return $state_name;
}
add_filter( 'rpress_get_state_name', 'my_state_name', 10, 2 );
Source#
Applied in:
includes/country-functions.php(line 1855), inrpress_get_state_name()
See also#
Was this page helpful?
