FREE PLUGIN

CountryLock
WordPress Plugin

Block the noise. Let real users in.

A zero‑bloat WordPress plugin that lets you allow countries in one click. No upsells. No gimmicks. No frontend scripts. Just control.

THE Plugin

Quick Summary

CountryLock WordPress Plugin

Purpose

Keep bandwidth, analytics, and security clean by allowing only the countries you care about.

How it works

Checks the visitor’s country before your site loads and blocks/redirects if they’re not allowed.

Tech notes

PHP‑only. No frontend JS. Optional remote IP lookup. Works with Cloudflare / Kinsta / Proxies / etc.

Who it’s for

Site owners sick of being billed by their web host for junk traffic, login attacks, and fake analytics.

The Tools

Core Features

One‑Toggle Enable/Disable

Turn enforcement on/off without uninstalling.

Block Pages

Default “Access Denied” page.

Logging & Stats

Lightweight table stores deny events (IP, country, path, UA, timestamp).

Dark Mode Admin UI

Clean, TopSyde‑styled settings panel.

Uninstall Cleanup

Optionally remove settings + logs on uninstall.

Allowed Countries List

Default is US‑only. Add as many ISO‑2 countries as you like.

Admin Bypass

Logged‑in admins never get blocked (so you can’t lock yourself out).

IP Allowlist

Whitelist single IPs or CIDR ranges (203.0.113.0/24).

Respect Real Client IP

Reads CF-Connecting-IP, X-Forwarded-For, HTTP_X_REAL_IP, Kinsta-Client-IP, etc.

Backup Remote Lookup

If a host doesn’t expose geo headers, enables a one‑field lookup via ipapi.co.

CountryLock WordPress Plugin
THE SOLUTION

Why CountryLock (and not another bloated firewall)?

  • Zero bloat. No asset payloads, no popups, no nags. Just a clean settings page.

  • Fast. Runs early. Doesn’t drag your TTFB or CLS.

  • Honest. No paid add‑ons, no “Pro upgrade” walls.

  • Accurate. Uses server‑provided IP headers (Cloudflare/Kinsta/XFF) before any remote lookup.

  • Visible. Built‑in block log and simple charts so you can see what’s getting denied.

Save Money on Hosting

This customer has a local business in Ohio (childcare) – yet was paying for 10X visits on their site from foreign countries completely unrelated to their customer base.  Not anymore!

Country Lock Activated

Documentation

Setup in 60 Seconds

  1. Install & Activate: Upload to /wp-content/plugins/countrylock/ or install from the WP directory.

  2. Go to: Settings → CountryLock.

  3. Enable the toggle.

  4. Choose Allowed Countries (start with US, add others as needed).

  5. (Optional) Add your known office/home IPs to the IP Allowlist.

  6. (Optional) If your host doesn’t pass geo headers, toggle Remote Lookup.

Tip: Behind Cloudflare? Make sure the CF‑Connecting‑IP header is enabled (default). You’re good.

Testing (Do this after enabling)

  • Use a VPN to simulate traffic from a blocked country → you should see the Access Denied page.

  • Disable VPN → site loads normally.

  • Check Settings → CountryLock → Block Log to verify entries are recorded.

Troubleshooting

Seeing your own visits blocked?

  • You’re probably not logged in and your country isn’t on the allow list (or your IP is behind NAT/Proxy). Add your IP to Allowlist.

Geo detection seems wrong?

  • Some hosts hide the real client IP. Enable Remote Lookup or ask your host which client IP header is authoritative.

Cloudflare/Kinsta/Proxy setup

  • CountryLock checks multiple headers in order. If you use a custom proxy, ensure it sets X-Forwarded-For (client first) or X-Real-IP.

Caches/Performance plugins

  • CountryLock runs before templates; it plays nice with page cache. If a CDN is serving a cached HTML to everyone, enforce at the CDN too.

White‑labelling / Branding

  • Customize the block message in settings. (No frontend scripts required.)

Privacy

  • CountryLock only logs IP (binary), country code, path, UA, timestamp.

  • If Remote Lookup is enabled, only the visitor IP is sent to ipapi.co for country resolution.

  • No personal data or site metadata is transmitted.

Requirements

  • WordPress 6.0+

  • PHP 7.4+

  • Works with classic hosting, Cloudflare, and managed hosts (Kinsta, WP Engine, etc.)

Changelog (Highlights)

  • 1.0.5 – Performance polish, expanded IP/header detection, better logs.
  • 1.0.4 – UI refinements, safer defaults, smoother block page.
  • 1.0.3 – Rebrand from US‑Only AccessCountryLock; added stats and clean visuals.
  • 1.0.1 – Initial release.

Support

  • Docs: You’re here.

  • Bug? Open an issue or contact us

  • Priority help? We offer white‑glove support under our hosting plans.

One Plan.
Everything You Need.

This isn’t hosting. This is active, expert management of your most important asset.

  • Expert Management
    • Hand-Optimized for Speed
    • Direct Developer Support
    • Proactive Updates & Security
    • Monthly Report & Dashboard

    Included Pro Toolkit

    • Free Licenses: Elementor Pro, WP Rocket, Perfmatters & more.

    Elite Platform

    • Google C3D Servers
    • High-Traffic Ready (50+ PHP Workers, 8GB PHP Memory, NGINX)
    • Free Migration, DNS Config, SSL & CDN
    • Unlimited Everything

    The Guarantee

    • Result: 90+ PageSpeed Scores
    • Security hardened
    • 30-Day Free Trial
    • No Contracts