{"id":334809,"date":"2026-07-05T06:50:42","date_gmt":"2026-07-05T06:50:42","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/honeill-geoip\/"},"modified":"2026-07-05T06:50:04","modified_gmt":"2026-07-05T06:50:04","slug":"honeill-visitor-country-detection","status":"publish","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/honeill-visitor-country-detection\/","author":23524743,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.2.4","stable_tag":"1.2.4","tested":"7.0","requires":"5.6","requires_php":"7.4","requires_plugins":null,"header_name":"Honeill Visitor Country Detection","header_author":"Hayden O'Neill","header_description":"Show the right content to the right country. Detects a visitor's country from their IP using MaxMind GeoLite2 \u2014 auto-downloaded and kept updated with your own license key \u2014 and exposes it through a filter and a REST endpoint.","assets_banners_color":"","last_updated":"2026-07-05 06:50:04","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"","rating":0,"author_block_rating":0,"active_installs":0,"downloads":41,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.2.4":{"tag":"1.2.4","author":"honeill","date":"2026-07-05 06:50:04"}},"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.2.4"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[3751,4124,4169,3919,270129],"plugin_category":[49],"plugin_contributors":[269707],"plugin_business_model":[],"class_list":["post-334809","plugin","type-plugin","status-publish","hentry","plugin_tags-country","plugin_tags-geolocation","plugin_tags-geotargeting","plugin_tags-ip-address","plugin_tags-visitor-country","plugin_category-maps-and-location","plugin_contributors-honeill","plugin_committers-honeill"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/honeill-visitor-country-detection.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Honeill Visitor Country Detection detects a visitor's country (ISO 3166-1 alpha-2, e.g. <code>GB<\/code>) 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.<\/p>\n\n<p>The GeoLite2 database is <strong>not<\/strong> bundled \u2014 MaxMind's license does not allow redistribution. Instead you enter your own free MaxMind license key once on the settings screen. The plugin then:<\/p>\n\n<ul>\n<li>downloads the GeoLite2 country database immediately,<\/li>\n<li>stores it in <code>wp-content\/uploads<\/code> (so it survives plugin updates),<\/li>\n<li>and refreshes it automatically every week via WP-Cron.<\/li>\n<\/ul>\n\n<p>You never download or upload a database by hand.<\/p>\n\n<h4>Use it in your code<\/h4>\n\n<pre><code>$country = apply_filters( 'honeill_visitor_country_detection_country_code', '' );\n<\/code><\/pre>\n\n<p>Returns a two-letter country code, or an empty string when it can't be determined (local IP, missing database, etc.) \u2014 your code decides the fallback. Results are cached per IP, so it's cheap to call on every request.<\/p>\n\n<p>Prefer REST? <code>GET \/wp-json\/honeill-visitor-country-detection\/v1\/country<\/code> returns <code>{ \"country\": \"GB\" }<\/code> for the caller.<\/p>\n\n<p>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.<\/p>\n\n<h3>External services<\/h3>\n\n<p>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.<\/p>\n\n<ul>\n<li><strong>Service:<\/strong> MaxMind GeoLite2 database download (<code>https:\/\/download.maxmind.com\/app\/geoip_download<\/code>).<\/li>\n<li><strong>When it connects:<\/strong> when you save your license key, when you click \"Update database now\", and automatically once per week.<\/li>\n<li><strong>What is sent:<\/strong> 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.<\/li>\n<\/ul>\n\n<p>By using this plugin you agree to MaxMind's GeoLite2 End User License Agreement and Privacy Policy:<\/p>\n\n<ul>\n<li>Terms: https:\/\/www.maxmind.com\/en\/geolite2\/eula<\/li>\n<li>Privacy: https:\/\/www.maxmind.com\/en\/privacy_policy<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>honeill-visitor-country-detection<\/code> folder to <code>\/wp-content\/plugins\/<\/code>, or install the ZIP via Plugins \u2192 Add New \u2192 Upload Plugin.<\/li>\n<li>Activate the plugin.<\/li>\n<li>Create a free MaxMind account and generate a license key (Account \u2192 Manage License Keys): https:\/\/www.maxmind.com\/en\/geolite2\/signup<\/li>\n<li>Go to <strong>Settings \u2192 Honeill Visitor Country Detection<\/strong>, paste your license key, and click <strong>Save &amp; download database<\/strong>.<\/li>\n<li>That's it \u2014 the database downloads now and auto-updates weekly.<\/li>\n<\/ol>\n\n<p>Advanced: instead of the settings field you can define the key in <code>wp-config.php<\/code> with <code>define( 'HONEILL_VISITOR_COUNTRY_DETECTION_LICENSE_KEY', 'your-key' );<\/code> to keep it out of the database.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id=\"is%20it%20allowed%20to%20use%20geolite2%20this%20way%3F\"><h3>Is it allowed to use GeoLite2 this way?<\/h3><\/dt>\n<dd><p>Yes. You use your own license key to download your own copy of the database \u2014 nothing is redistributed, which is what MaxMind's license restricts. Attribution to MaxMind is included as required.<\/p><\/dd>\n<dt id=\"where%20is%20the%20database%20stored%3F\"><h3>Where is the database stored?<\/h3><\/dt>\n<dd><p>In <code>wp-content\/uploads\/honeill-visitor-country-detection\/<\/code>. It is kept out of the plugin folder so plugin updates don't wipe it. The plugin also drops an <code>.htaccess<\/code> to block direct web access on Apache.<\/p><\/dd>\n<dt id=\"can%20it%20detect%20city%20or%20region%2C%20not%20just%20country%3F\"><h3>Can it detect city or region, not just country?<\/h3><\/dt>\n<dd><p>It ships with the lighter GeoLite2-Country database. City is a small change (the edition id and filename) but needs more disk space and exposes additional fields.<\/p><\/dd>\n<dt id=\"my%20site%20is%20behind%20cloudflare%20%2F%20a%20load%20balancer.%20will%20it%20still%20work%3F\"><h3>My site is behind Cloudflare \/ a load balancer. Will it still work?<\/h3><\/dt>\n<dd><p>Yes \u2014 it reads the left-most public IP from <code>X-Forwarded-For<\/code>, falling back to <code>REMOTE_ADDR<\/code>.<\/p><\/dd>\n<dt id=\"downloads%20fail.%20why%3F\"><h3>Downloads fail. Why?<\/h3><\/dt>\n<dd><p>Most often an incorrect license key (MaxMind returns 401\/403), or the PHP <code>Phar<\/code> extension is disabled (needed to unpack the download). The settings screen shows both.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.2.4<\/h4>\n\n<ul>\n<li>Per-IP lookup results are now cached with the object cache API instead of transients. Spoofed X-Forwarded-For values could previously create unbounded per-IP transient rows in the options table.<\/li>\n<\/ul>\n\n<h4>1.2.3<\/h4>\n\n<ul>\n<li>Renamed the plugin to \"Honeill Visitor Country Detection\" (slug <code>honeill-visitor-country-detection<\/code>). No functional changes; filter, REST namespace, options, and constant names now use the new prefix.<\/li>\n<\/ul>\n\n<h4>1.2.2<\/h4>\n\n<ul>\n<li>Tidied the plugin description (now mentions the REST endpoint).<\/li>\n<\/ul>\n\n<h4>1.2.1<\/h4>\n\n<ul>\n<li>\"Remove key\" is now a button instead of a checkbox. The settings screen also documents the REST endpoint.<\/li>\n<\/ul>\n\n<h4>1.2.0<\/h4>\n\n<ul>\n<li>License key field is now write-only and masked \u2014 the saved key is never rendered back to the browser. Added a \"Remove the saved key\" option.<\/li>\n<li>REST endpoint now sends no-cache headers so a per-visitor result is never cached by a CDN or page cache.<\/li>\n<\/ul>\n\n<h4>1.1.0<\/h4>\n\n<ul>\n<li>Added a REST endpoint: GET \/wp-json\/honeill-visitor-country-detection\/v1\/country returns the caller's country code.<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release: country detection via the <code>honeill_visitor_country_detection_country_code<\/code> filter, license-key-based download, weekly auto-update, and a settings screen.<\/li>\n<\/ul>","raw_excerpt":"Visitor country from their IP via MaxMind GeoLite2 \u2014 downloaded with your own license key, exposed through a filter and a REST endpoint.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/334809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=334809"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/honeill"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=334809"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=334809"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=334809"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=334809"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=334809"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=334809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}