WordPress at Your Fingertips
function is not described

WC_Countries::get_continent_code_for_country() public WC 2.6.0

Get continent code for a country code.

{} It's a method of the class: WC_Countries{}

No Hooks.

Return

String.

Usage

$WC_Countries = new WC_Countries();
$WC_Countries->get_continent_code_for_country( $cc );
$cc(string) (required)
Country code.

Changelog

Since 2.6.0 Introduced.

Code of WC_Countries::get_continent_code_for_country() WC 5.7.1

public function get_continent_code_for_country( $cc ) {
	$cc                 = trim( strtoupper( $cc ) );
	$continents         = $this->get_continents();
	$continents_and_ccs = wp_list_pluck( $continents, 'countries' );
	foreach ( $continents_and_ccs as $continent_code => $countries ) {
		if ( false !== array_search( $cc, $countries, true ) ) {
			return $continent_code;
		}
	}

	return '';
}