Geo IP at WP Engine

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

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:

Country: US
Region (State): VA
City: Ashburn
Postal Code: 20149
Latitude: 39.04810
Longitude: -77.47280
Location: Ashburn, VA US

Shortcodes:

Country: [geoip-country]
Region (State): [geoip-region]
City: [geoip-city]
Postal Code: [geoip-postalcode]
Latitude: [geoip-latitude]
Longitude: [geoip-longitude]
Location: [geoip-location]

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:

With that, you could do more advanced functions with conditional statements. The following will perform a redirect using wp_redirect() if the visitor’s country is “US”:

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:

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:

In addition, you can easily test these changes by adding query arguments to the end of the URL:

So instead of using a proxy or VPN, you can visit your website as a visitor from Canada:

http://fixpress.wpengine.com/geo-ip-at-wp-engine.html?geoip&country=CA&city=Toronto&region=ON

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.