WPLocation is a free WordPress geolocation and geotargeting plugin for country-based content. Show the right post, page or content section to a visitor's detected country using a local GeoLite2 Country database.
What you can do with Free
- Set include or exclude country audiences for WordPress posts, pages and categories.
- Show selected sections with the Country visibility block in the WordPress block editor.
- Use [wplocation_target] for country-based conditional content and [wplocation_country] to display the detected country.
- Search country choices, review a saved audience and test a country decision before checking the real page.
- Check your local source and database build date in Diagnostics.
- Use your own current licensed country database without a paid WPLocation key or visitor lookup credits.
Practical examples
Show a regional announcement on a shared page, display a country-specific message, or limit a published page to selected countries. Keep useful general content outside targeted sections. IP location is approximate: country visibility is personalization, not a firewall or access control for confidential content.
Set up your first country rule
Install Free, connect a current licensed GeoLite2 Country database in Settings, check Diagnostics and create a page audience or Country visibility block. Test allowed, denied and unknown locations and your actual page cache. Follow the illustrated setup guide:
https://wplocation.com/documentation/installation/.
Free, Pro and add-ons
Free works independently and is distributed and updated through
WordPress.org. Pro and specialist add-ons are separate plugins sold by
WPLocation.com; keep Free active with Pro. Pro adds WooCommerce rules, Geo Redirects, Markets, Forms & Campaigns and opt-in Geo Analytics. Pro 1.4.5 or newer requires PHP 8.3. No paid feature implementation is locked inside Free.
SEO and cache behavior
Country visibility does not create translations, regional URLs or hreflang tags and does not guarantee search rankings. A crawler outside a whole-page audience can receive a 404, and a targeted section may be absent from its view. Use discoverable regional URLs when needed and treat crawlers like visitors from the same country. Setup and limitations:
https://wplocation.com/documentation/geolocation-speed-seo/.
Country data, privacy and safe upgrades
Local country lookup needs a current, licensed GeoLite2 Country MMDB. Separately installed, trusted country-source adapters may provide a verified country through the extension hook; their infrastructure and privacy requirements are documented by that adapter. No visitor-country service or paid account is required by Free itself. It does not bundle location data. You can select a private server file or use your own MaxMind account ID and license key to download one from Settings. Automatic updates are opt in and off by default. When enabled, the updater contacts MaxMind for an authorized download and follows its signed Cloudflare R2 file URL. The providers receive your site's server IP and MaxMind receives the account credentials. Visitor IPs remain on your server during local lookups and are not sent by the updater. See
https://dev.maxmind.com/geoip/geolite2-free-geolocation-data/,
https://www.maxmind.com/en/geolite/eula,
https://www.maxmind.com/en/privacy-policy and
https://www.cloudflare.com/privacypolicy/.
Saved MaxMind credentials are non-autoloaded WordPress options, not encrypted at rest; they may appear in database backups. For stronger secret management, define WPLOCATION_MAXMIND_ACCOUNT_ID and WPLOCATION_MAXMIND_LICENSE_KEY in wp-config.php. Those constants take priority. The plugin does not display saved keys or record them in its activity log.
Store the MMDB outside the public web root. Automatic updates save validated copies beside the configured source, select them atomically and retain the last working file on failure. Recorded unchanged retired copies can be removed after two days; configured and untracked files remain the site's responsibility. WordPress cron needs traffic or a server cron. Follow MaxMind's database update and deletion requirements. This product can use GeoLite Data created by MaxMind, available from
https://www.maxmind.com/.
Geolocation is approximate and these rules are for personalization, not access control for confidential content. When a country cannot be determined, restricted content is hidden. Caches and CDNs can serve the wrong country or bypass WordPress altogether. While Free is active, the plugin requests no-store responses for frontend HTML and country-aware post, page and search REST reads because targeted content can appear in posts, blocks and secondary queries. It purges WP Super Cache when its API is present, but you must configure and test any shared cache. Forwarded IP headers are not trusted by default; verified infrastructure can provide an address with the wplocation_verified_client_ip filter.
Upgrading an older standalone build requires a current country source. A database stored inside the old plugin folder is removed by WordPress's replacement flow; this release does not bundle, restore or silently copy obsolete location data. Before updating, back up the site and rules, prepare a current licensed GeoLite2 Country MMDB outside the plugin folder and public web root, and select it with the documented upgrade preparation tool or configuration constant. Existing private database settings and audience storage keys are retained. Without a readable source, country-restricted output stays hidden and the dashboard provides recovery steps. Purge and test every external page or CDN cache after updating.
For older content, standard post and text-widget rendering translates [locationtarget] markup to [wplocation_target] before WordPress processes shortcodes. This does not register the unprefixed legacy shortcode and does not edit saved posts or revisions. Escaped examples are preserved; another plugin that registers the old tag keeps ownership. Use the prefixed shortcode for new content. Page-builder metadata, custom fields and direct do_shortcode() integrations need a separate review and conversion. Private database settings and content are per site on multisite; prepare and verify every site before a network update.
The combined plugin is GPLv3 or later and contains third-party libraries under their own licenses, including Apache-2.0 MaxMind libraries. See THIRD-PARTY-NOTICES.txt and vendor license files.