Title: Wonderful Geoblocking Countries
Author: wonderfulplugins
Published: <strong>July 25, 2026</strong>
Last modified: July 25, 2026

---

Search plugins

![](https://ps.w.org/wonderful-geoblocking-countries/assets/icon-256x256.png?rev
=3622600)

# Wonderful Geoblocking Countries

 By [wonderfulplugins](https://profiles.wordpress.org/wonderfulplugins/)

[Download](https://downloads.wordpress.org/plugin/wonderful-geoblocking-countries.1.0.2.zip)

 * [Details](https://wordpress.org/plugins/wonderful-geoblocking-countries/#description)
 * [Reviews](https://wordpress.org/plugins/wonderful-geoblocking-countries/#reviews)
 *  [Installation](https://wordpress.org/plugins/wonderful-geoblocking-countries/#installation)
 * [Development](https://wordpress.org/plugins/wonderful-geoblocking-countries/#developers)

 [Support](https://wordpress.org/support/plugin/wonderful-geoblocking-countries/)

## Description

Some sites simply do not need worldwide traffic — or keep getting spam registrations
and brute-force login attempts from countries they never do business with.

**Wonderful Geoblocking Countries** lets you block three areas of your site independently,
each with its own country list and its own message:

 * **Site access** — the whole public frontend.
 * **Login** — the wp-login.php page.
 * **Registration** — the user registration form.

For every area you pick the mode that fits:

 * **Block list** — block visitors from the selected countries and allow everyone
   else.
 * **Allow list** — allow only the selected countries and block everyone else (e.
   g. “only visitors from Austria, Germany and Switzerland may log in”).

Blocked visitors receive an HTTP 403 response with your custom message (basic HTML
allowed).

**Built-in safety rails:**

 * Logged-in administrators are never geoblocked, so you cannot lock yourself out
   of a site you are logged in to.
 * The WordPress admin and the login page are never affected by the _site access_
   rule — login blocking is its own explicit setting.
 * Visitors whose country cannot be determined are never blocked.

**Geolocation data:** the plugin uses the free IP2Location LITE country database(
IPv4 + IPv6). The database is _not_ bundled: you create a free account at lite.ip2location.
com, paste your personal download token into the settings, and the plugin downloads
the database (a few MB) onto your server. Once installed, it refreshes itself about
once a month — an automatic update you can switch off at any time.

Sites behind a CDN or reverse proxy can feed the real visitor IP (or a ready-made
country code, e.g. from Cloudflare’s `CF-IPCountry` header) into the plugin via 
the `wonderful_geoblocking_countries_client_ip` and `wonderful_geoblocking_countries_pre_country_code`
filters.

This plugin uses IP2Location LITE data available from https://lite.ip2location.com.

### External services

This plugin can download the IP2Location LITE geolocation database from www.ip2location.
com. The download only happens when you actively configure it: you enter your personal
download token and click the download button (afterwards a monthly scheduled refresh
re-downloads the database with the same token). The token you obtained from your
lite.ip2location.com account is sent to www.ip2location.com as part of the download
request; no data about your visitors is ever transmitted. This service is provided
by IP2Location.com: [terms of use](https://www.ip2location.com/terms), [privacy policy](https://www.ip2location.com/privacy).

All country lookups for your visitors happen locally on your server against the 
downloaded database file — visitor IP addresses never leave your site.

## Screenshots

[⌊The settings page: database setup and per-area country lists with custom block
messages.⌉⌊The settings page: database setup and per-area country lists with custom
block messages.⌉[

The settings page: database setup and per-area country lists with custom block messages.

## Installation

 1. Upload the `wonderful-geoblocking-countries` folder to the `/wp-content/plugins/`
    directory.
 2. Activate the plugin through the ‘Plugins’ menu in WordPress.
 3. Create a free account at [lite.ip2location.com](https://lite.ip2location.com/) 
    and copy your download token.
 4. Go to **Settings > Geoblocking Countries**, paste the token, save, and click **
    Download / update database now**.
 5. Pick the countries to block per area, write your block messages, done!

## FAQ

### Why is the geolocation database not included in the plugin?

The IP2Location LITE database is free but published under its own license that requires
every user to register for their own copy. The download with your personal token
takes less than a minute and enables automatic monthly updates.

### What happens while no database is installed?

Nothing — no visitor is blocked. The plugin shows an admin notice until a database
is installed, and visitors whose country cannot be determined are always let through.

### Can I lock myself out?

Not while you are logged in: administrators are always exempt from all three rules.
Only the _login_ rule can affect you when you are logged out and your own country
is on its list — the settings page warns you about exactly that.

### My site runs behind Cloudflare or another proxy — the detected country is wrong.

Behind a proxy, `REMOTE_ADDR` is the proxy’s address, not the visitor’s. Use the`
wonderful_geoblocking_countries_client_ip` filter to supply the real client IP from
a header you trust, or short-circuit the lookup entirely with `wonderful_geoblocking_countries_pre_country_code`(
e.g. return the value of Cloudflare’s `CF-IPCountry` header).

### Does blocking also apply to the REST API and feeds?

The _site access_ rule runs on every frontend request, including feeds and the REST
API. The WordPress admin (including admin-ajax) and wp-login.php are excluded from
it.

### Is any visitor data sent to a third party?

No. Country lookups run locally against the downloaded database file. The only external
request is the database download itself, which you trigger with your own token.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“Wonderful Geoblocking Countries” is open source software. The following people 
have contributed to this plugin.

Contributors

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

[Translate “Wonderful Geoblocking Countries” into your language.](https://translate.wordpress.org/projects/wp-plugins/wonderful-geoblocking-countries)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/wonderful-geoblocking-countries/),
check out the [SVN repository](https://plugins.svn.wordpress.org/wonderful-geoblocking-countries/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/wonderful-geoblocking-countries/)
by [RSS](https://plugins.trac.wordpress.org/log/wonderful-geoblocking-countries/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.0.2

 * Updated the bundled Select2 library from the 4.1.0 release candidate to the stable
   4.1.0 release (now managed via Composer).
 * Fixed the IP2Location terms-of-use link in the readme.
 * Corrected the “Tested up to” header to a major.minor WordPress version.

#### 1.0.1

 * Added a `wonderful_geoblocking_countries_country_for_ip` filter so other plugins
   can reuse the IP2Location country lookup.

#### 1.0.0

 * Initial release.

## Meta

 *  Version **1.0.2**
 *  Last updated **9 hours ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 6.2 or higher **
 *  Tested up to **7.0.2**
 *  PHP version ** 7.4 or higher **
 * Tags
 * [Block countries](https://wordpress.org/plugins/tags/block-countries/)[country block](https://wordpress.org/plugins/tags/country-block/)
   [Geoblocking](https://wordpress.org/plugins/tags/geoblocking/)[geolocation](https://wordpress.org/plugins/tags/geolocation/)
   [security](https://wordpress.org/plugins/tags/security/)
 *  [Advanced View](https://wordpress.org/plugins/wonderful-geoblocking-countries/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/wonderful-geoblocking-countries/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/wonderful-geoblocking-countries/reviews/)

## Contributors

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

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/wonderful-geoblocking-countries/)