Wonderful Geoblocking Countries icon

Wonderful Geoblocking Countries

Control access by country — and keep out VPN users — for your site, logins or registrations.

Take control of who can reach your WordPress site. Wonderful Geoblocking Countries lets you block three areas independently — the whole public site, the login page, and the user registration form — each with its own country list and its own message.

The settings page: country database and optional VPN list, per-area country lists, VPN blocking and custom block messages.

For every area you choose the mode that fits: a block list (keep out visitors from the selected countries) or an allow list (let in only the selected countries and block everyone else). Blocked visitors receive an HTTP 403 response with your own message (basic HTML allowed).

New in 1.1.0 — block VPN users: every area can also block visitors who use a VPN service, regardless of the country their VPN server is in. Without it, anyone could walk around a country rule with a VPN. The plugin uses the free X4BNet VPN list (MIT license, the IP ranges of the common VPN providers): one checkbox, no account or token, about 200 KB, refreshed every week.

Privacy-first geolocation: country lookups run locally on your server against the free IP2Location LITE database — no visitor IP is ever sent to a third-party API. The database installs with your personal download token and refreshes itself automatically about once a month; the optional VPN list is stored on your server as well and refreshes weekly (both can be switched off at any time).

Built-in safety rails: logged-in administrators are never blocked, the WordPress admin and the login page stay reachable from the site-access rule, and visitors whose country cannot be determined are always let through — so you cannot lock yourself out by accident.

For developers: a wonderful_geoblocking_countries_country_for_ip filter lets other plugins reuse the local IP2Location country lookup for any IP address, without a hard dependency on this plugin — $country = apply_filters( 'wonderful_geoblocking_countries_country_for_ip', '', $ip );. With the VPN list installed, wonderful_geoblocking_countries_is_vpn_ip tells whether an IP belongs to a VPN provider.

What's new in 1.1.0

  • New: VPN blocking for site access, login and registration, based on the free X4BNet VPN list — works in block-list and allow-list mode alike.
  • Improved: a clearer database section — the required country database and the optional VPN list each show their own status, and one button updates both.
  • Improved: the settings page shows whether your own IP is on the VPN list, and downloads are validated before they replace installed data.

Version 1.1.0 — View on WordPress.org

Questions about this tool? Get in touch.