/Simple Country Blocker - WordPress Plugin

First commit: 31 January 2023
WordPress Development
Simple Country Blocker - WordPress Plugin

Project Overview

Simple Country Blocker is a WordPress plugin for restricting normal front-end page access based on the visitor's country, estimated from their IP address. Site owners choose the countries to block in the plugin settings.

How It Works

  • Looks up the request IP with IPinfo over HTTPS and caches successful country results for 12 hours.
  • Includes a test IP field so an administrator can check the country lookup before enabling a rule.
  • Makes no visitor lookup when no countries are selected.
  • Allows access if the IP is private or invalid, or if the lookup service is unavailable, so a lookup outage does not lock out visitors.

Implementation Notes

The plugin is written for WordPress and PHP. The repository includes focused tests for country lookup, admin settings, and IP handling.

Country detection is an estimate and can be affected by VPNs or proxies. This plugin only checks normal WordPress front-end requests; it is not a firewall, and cached pages or requests handled outside WordPress may bypass it. IP addresses sent for lookup are processed by IPinfo, so site owners should review their privacy policy and the provider's terms.

View the source code on GitHub

Tags - WordPressPHPIP GeolocationAccess ControlIPinfo

© 2026 Arif Islam. All rights reserved.
hello@arifislam.me