Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_Geolocation::get_country_code_from_headers()
Fetches the country code from the request headers, if one is available.
Description Description
Return Return
(string) The country code pulled from the headers, or empty string if one was not found.
Source Source
File: includes/class-wc-geolocation.php
private static function get_country_code_from_headers() { $country_code = ''; $headers = array( 'MM_COUNTRY_CODE', 'GEOIP_COUNTRY_CODE', 'HTTP_CF_IPCOUNTRY', 'HTTP_X_COUNTRY_CODE', ); foreach ( $headers as $header ) { if ( empty( $_SERVER[ $header ] ) ) { continue; } $country_code = strtoupper( sanitize_text_field( wp_unslash( $_SERVER[ $header ] ) ) ); break; } return $country_code; }
Changelog Changelog
Version | Description |
---|---|
3.9.0 | Introduced. |