Title: Honeill Visitor Country Detection
Author: honeill
Published: <strong>5 Luglio 2026</strong>
Last modified: 5 Luglio 2026

---

Ricerca i plugin

![](https://s.w.org/plugins/geopattern-icon/honeill-visitor-country-detection.svg)

# Honeill Visitor Country Detection

 Di [honeill](https://profiles.wordpress.org/honeill/)

[Scarica](https://downloads.wordpress.org/plugin/honeill-visitor-country-detection.1.2.4.zip)

 * [Dettagli](https://it.wordpress.org/plugins/honeill-visitor-country-detection/#description)
 * [Recensioni](https://it.wordpress.org/plugins/honeill-visitor-country-detection/#reviews)
 *  [Installazione](https://it.wordpress.org/plugins/honeill-visitor-country-detection/#installation)
 * [Sviluppo](https://it.wordpress.org/plugins/honeill-visitor-country-detection/#developers)

 [Supporto](https://wordpress.org/support/plugin/honeill-visitor-country-detection/)

## Descrizione

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

## Installazione

 1. Upload the `honeill-visitor-country-detection` folder to `/wp-content/plugins/`,
    or install the ZIP via Plugins  Add New  Upload Plugin.
 2. Activate the plugin.
 3. Create a free MaxMind account and generate a license key (Account  Manage License
    Keys): https://www.maxmind.com/en/geolite2/signup
 4. Go to **Settings  Honeill Visitor Country Detection**, paste your license key, 
    and click **Save & download database**.
 5. That’s it — the database downloads now and auto-updates weekly.

Advanced: instead of the settings field you can define the key in `wp-config.php`
with `define( 'HONEILL_VISITOR_COUNTRY_DETECTION_LICENSE_KEY', 'your-key' );` to
keep it out of the database.

## FAQ

### Is it allowed to use GeoLite2 this way?

Yes. You use your own license key to download your own copy of the database — nothing
is redistributed, which is what MaxMind’s license restricts. Attribution to MaxMind
is included as required.

### Where is the database stored?

In `wp-content/uploads/honeill-visitor-country-detection/`. It is kept out of the
plugin folder so plugin updates don’t wipe it. The plugin also drops an `.htaccess`
to block direct web access on Apache.

### Can it detect city or region, not just country?

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.

### My site is behind Cloudflare / a load balancer. Will it still work?

Yes — it reads the left-most public IP from `X-Forwarded-For`, falling back to `
REMOTE_ADDR`.

### Downloads fail. Why?

Most often an incorrect license key (MaxMind returns 401/403), or the PHP `Phar`
extension is disabled (needed to unpack the download). The settings screen shows
both.

## Recensioni

Non ci sono recensioni per questo plugin.

## Contributi e sviluppo

“Honeill Visitor Country Detection” è un software open source. Le persone che hanno
contribuito allo sviluppo di questo plugin sono indicate di seguito.

Collaboratori

 *   [ honeill ](https://profiles.wordpress.org/honeill/)

[Traduci “Honeill Visitor Country Detection” nella tua lingua.](https://translate.wordpress.org/projects/wp-plugins/honeill-visitor-country-detection)

### Ti interessa lo sviluppo?

[Esplora il codice](https://plugins.trac.wordpress.org/browser/honeill-visitor-country-detection/)
segui il [repository SVN](https://plugins.svn.wordpress.org/honeill-visitor-country-detection/),
segui il [log delle modifiche](https://plugins.trac.wordpress.org/log/honeill-visitor-country-detection/)
tramite [RSS](https://plugins.trac.wordpress.org/log/honeill-visitor-country-detection/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.2.4

 * 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.

#### 1.2.3

 * Renamed the plugin to “Honeill Visitor Country Detection” (slug `honeill-visitor-
   country-detection`). No functional changes; filter, REST namespace, options, 
   and constant names now use the new prefix.

#### 1.2.2

 * Tidied the plugin description (now mentions the REST endpoint).

#### 1.2.1

 * “Remove key” is now a button instead of a checkbox. The settings screen also 
   documents the REST endpoint.

#### 1.2.0

 * License key field is now write-only and masked — the saved key is never rendered
   back to the browser. Added a “Remove the saved key” option.
 * REST endpoint now sends no-cache headers so a per-visitor result is never cached
   by a CDN or page cache.

#### 1.1.0

 * Added a REST endpoint: GET /wp-json/honeill-visitor-country-detection/v1/country
   returns the caller’s country code.

#### 1.0.0

 * Initial release: country detection via the `honeill_visitor_country_detection_country_code`
   filter, license-key-based download, weekly auto-update, and a settings screen.

## Meta

 *  Versione **1.2.4**
 *  Ultimo aggiornamento **4 mesi fa**
 *  Installazioni attive **Meno di 10**
 *  Versione WordPress ** 5.6 o superiore **
 *  Testato fino alla versione **7.0.8**
 *  Versione PHP ** 7.4 o superiore **
 *  Lingua
 * [English (US)](https://wordpress.org/plugins/honeill-visitor-country-detection/)
 * Tag
 * [country](https://it.wordpress.org/plugins/tags/country/)[geolocation](https://it.wordpress.org/plugins/tags/geolocation/)
   [geotargeting](https://it.wordpress.org/plugins/tags/geotargeting/)[ip address](https://it.wordpress.org/plugins/tags/ip-address/)
 *  [Visualizzazione avanzata](https://it.wordpress.org/plugins/honeill-visitor-country-detection/advanced/)

## Valutazioni

Non sono state ancora inviate recensioni.

[La tua recensione](https://wordpress.org/support/plugin/honeill-visitor-country-detection/reviews/#new-post)

[Vedi tutte le recensioni](https://wordpress.org/support/plugin/honeill-visitor-country-detection/reviews/)

## Collaboratori

 *   [ honeill ](https://profiles.wordpress.org/honeill/)

## Supporto

Hai qualcosa da dire? Ti serve aiuto?

 [Chiedi nel forum di supporto](https://wordpress.org/support/plugin/honeill-visitor-country-detection/)