Skip to content
Docs
Get RestroPress

Filter

rpress_get_country_name

Updated
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#

ParameterTypeDescription
$country_namestringThe resolved country name, or the country code if it was not found in the list.
$country_codestringThe 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), in rpress_get_country_name()

See also#

Was this page helpful?