Honeill Visitor Country Detection
Honeill Visitor Country Detection detects a visitor’s country (ISO 3166-1 alpha-2, e.g. GB) from their IP address using MaxMind’s GeoLite2 database, and exposes it through a single WordPress filter so your theme or plugin can use it with no hard dependency.
The GeoLite2 database is not bundled — MaxMind’s license does not allow redistribution. Instead you enter your own free MaxMind license key once on the settings screen. The plugin then:
- downloads the GeoLite2 country database immediately,
- stores it in
wp-content/uploads(so it survives plugin updates), - and refreshes it automatically every week via WP-Cron.
You never download or upload a database by hand.
Use it in your code
$country = apply_filters( 'honeill_visitor_country_detection_country_code', '' );
Returns a two-letter country code, or an empty string when it can’t be determined (local IP, missing database, etc.) — your code decides the fallback. Results are cached per IP, so it’s cheap to call on every request.
Prefer REST? GET /wp-json/honeill-visitor-country-detection/v1/country returns { "country": "GB" } for the caller.
This product includes GeoLite2 Data created by MaxMind, available from https://www.maxmind.com. This plugin is an independent project and is not affiliated with, endorsed, or sponsored by MaxMind, Inc. GeoIP and GeoLite2 are trademarks of MaxMind, Inc.
External services
This plugin connects to MaxMind to download the GeoLite2 country database, which it needs to resolve countries. The database is not shipped with the plugin because MaxMind’s license prohibits redistribution.
- Service: MaxMind GeoLite2 database download (
https://download.maxmind.com/app/geoip_download). - When it connects: when you save your license key, when you click «Update database now», and automatically once per week.
- What is sent: your MaxMind license key (as a request parameter) and, by nature of any outbound HTTPS request, your server’s IP address. No website visitor data is ever sent to MaxMind.
By using this plugin you agree to MaxMind’s GeoLite2 End User License Agreement and Privacy Policy:
- Terms: https://www.maxmind.com/en/geolite2/eula
- Privacy: https://www.maxmind.com/en/privacy_policy