Skip to content


How-to Guides

Technical References

How to configure the VIP Go Geo Uniques plugin

Load the VIP Go Geo Uniques plugin

As the VIP Go Geo Uniques plugin requires configuration in code, we recommend loading this plugin using the wpcom_vip_load_plugin function.

Download the plugin from the GitHub repo, add it to your plugins folder, and then activate it for your site:

// Load the VIP Go Geo Uniques plugin
wpcom_vip_load_plugin( 'vip-go-geo-uniques' );

Configure the plugin

To configure the plugin, you must set a default location using the VIP_Go_Geo_Uniques::set_default_location method. For example, to set the United States as the default:

VIP_Go_Geo_Uniques::set_default_location( 'US' );

Next, configure each region using theVIP_Go_Geo_Uniques::add_location method. If a region is not set, visits from that region will use the default location. As an example, to create a geo unique region of the United Kingdom you would call:

VIP_Go_Geo_Uniques::add_location( 'GB' );

The complete example below sets the default location as the US (US), and a further location as the UK (GB).

//Configure the VIP Go Geo Uniques plugin
if ( class_exists( 'VIP_Go_Geo_Uniques' ) ) {
    VIP_Go_Geo_Uniques::set_default_location( 'US' );
    VIP_Go_Geo_Uniques::add_location( 'GB' );

Serving geotargeted content

You can now tailor your content to the different country audiences:

if ( function_exists( 'vip_geo_get_country_code' ) && 'GB' == vip_geo_get_country_code() ) {
    echo "Please select your favourite colour:";
} else {
    echo "Please select your favorite color:";

Unexpected country codes

Our country codes are supplied via the Maxmind GeoIP database, which implements special “pseudo country codes” for particular situations:


Please note that “EU” and “AP” codes are only used when a specific country code has not been designated (see FAQ). Blocking or re-directing by “EU” or “AP” will only affect a small portion of IP addresses. Instead, you should list the countries you want to block/re-direct individually.

GeoIP and ISO 3166 Country Codes

At time of writing, the GeoIP pseudo country codes are:

  • AP,”Asia/Pacific Region”
  • A1,”Anonymous Proxy”
  • A2,”Satellite Provider”
  • O1,”Other Country”
  • EU,”Europe”

A common misconception is that the country code for the United Kingdom is UK, in fact it is GB.

Last updated: May 30, 2021