Region Codes for WP Engine GeoIP
In a previous post I provided the full list of two-letter country codes for WP Engine’s GeoIP plugin. After having had the opportunity to work with this plugin more, I found out that that for those outside the United States, the two-letter region codes are not so simple.
For US states, the two letter codes are the standards used by our postal system (AK, CA, TX, MS, etc). However, if you want to target only customers in Shanghai, China, the two letter code is in fact two numbers (23).
To make matters more confusing, there are 48(!) other regions in the MaxMind GeoIP database that use the region 23, including but not limited to, Lam Dong, Vietnam; Tierra Del Fuego, Argentina; Qina, Egypt; and Offaly, Ireland. So, in order to target content correctly, you must not only use the region code, but also the country code. So to target Shanghai, China, you can use any of the following code examples:
1 2 3
[geoip-content country="CN" region="23"] Content only for Shanghai, China [/geoip-content] [geoip-content country="CN" not_region="23"]Content for China, except Shanghai [geoip-content] [geoip-content not_region="23"] Content for everywhere except places region "23"[/geoip-content]
Like the country code list, WP Engine does not have the full region code list available within their plugin. In order to get the full list of available two digit codes for specific regions/states/provinces of places around the world, check out this .CSV file from MaxMind: