Geo IP at WP Engine

If you host your WordPress at WP Engine, you’re interested in utilizing Geo IP, and your plan allows it, ask the Support team to move you to a compatible server and to enable Geo IP. Once you install and activate the WP Engine Geo IP plugin, then everything should start working without issue.

The following is an example of WP Engine’s Geo IP offerings and should display your geographic information. The shortcodes to use can be found underneath:

Note: Shortcodes only display this information back to the visitor. You may not be able to use it in conjunction with other plugins. You will usually need to resort to PHP coding to do more advanced processes. Here is the class and functions you can use to obtain this information. Note the GeoIP class you’ll need to initialize:

While you can certainly use the GeoIP class, the geo information can also be found in the environment variables. This is the information/array used to set the Geo info:

1

2

3

4

5

6

7

8

9

10

11

returnarray(

'countrycode'=&gt;getenv('HTTP_GEOIP_COUNTRY_CODE'),

'countrycode3'=&gt;getenv('HTTP_GEOIP_COUNTRY_CODE3'),

'countryname'=&gt;getenv('HTTP_GEOIP_COUNTRY_NAME'),

'latitude'=&gt;getenv('HTTP_GEOIP_LATITUDE'),

'longitude'=&gt;getenv('HTTP_GEOIP_LONGITUDE'),

'areacode'=&gt;getenv('HTTP_GEOIP_AREA_CODE'),

'region'=&gt;getenv('HTTP_GEOIP_REGION'),

'city'=&gt;getenv('HTTP_GEOIP_CITY'),

'postalcode'=&gt;getenv('HTTP_GEOIP_POSTAL_CODE'),

);

With that information, just note that outside of the plugin not working, you won’t be able to ask WP Engine for assistance with coding. There’s also no guarantee that the code above is functional and is to only be used for demonstration purposes.

New with WP Engine GeoIP v.1.1

The latest update to the WP Engine GeoIP plugin introduces new shortcodes. For instance, you can display text for a certain country, region, or exclude text from a city: