Filter
rpress_get_country_name
On this page
Filters the country name returned for a country code.
Applied at the end of rpress_get_country_name(). The function looks the code up in rpress_get_country_list() and falls back to the code itself when no match is found. Change the returned name to customise how a country is labelled.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$country_name | string | The resolved country name, or the country code if it was not found in the list. |
$country_code | string | The country code that was requested. |
Return value#
string. The country name to return.
Example#
function my_country_name( $country_name, $country_code ) {
if ( 'GB' === $country_code ) {
return 'UK';
}
return $country_name;
}
add_filter( 'rpress_get_country_name', 'my_country_name', 10, 2 );
Source#
Applied in:
includes/country-functions.php(line 1841), inrpress_get_country_name()
See also#
Was this page helpful?
