Geo-Location
The Get-Location shortcode for WordPress can be used to display user location within your post/page content. The location info is provided through Cloudflare headers, which means you website is required to use at least the Free plan of Cloudflare for this feature to work. Check below for example implementations and shortcode documentation:
Geo-Location Examples
Geo-Location Shortcodes
[x3m-geolocation display="Flag Country - Continent - City (Region)"]Geo-Location Documentation
First, the most important requirement for this shortcode to work is for your website to be served through Cloudflare (free plan works). Cloudflare offers geo-location data which is used by our shortcode to display the appropriate info. By default this service is activated in Cloudflare, but in case your website does not display the correct info, you need to activate this in your Cloudflare account for the specific website: 1. on your website Cloudflare account, go to Network > IP Geolocation and enable it; and 2. on your website Cloudflare account, go to Rules > Settings and enable “Add visitor location headers” (you may remove IP from data for GDPR compliance by also enabling “Remove visitor IP headers”).
Here are the shortcode option settings available for Geo-Location:
| Shortcode Settings | Details |
|---|---|
| display=”Flag” | used to display the flag of the user country. Flag is displayed as a unicode emoji. |
| display=”Country” | used to display the name of the country. Country names used for display are listed inside the plugin shortcode in /shortcodes/geo-location.php, where you can translate them to your language if English is not the language intended to use. |
| display=”City” | used to display the name of the city. |
| display=”Region” | used to display the name of the region/state, where available. |