Discover, trust, install: FAIR 1.0 is here
Block Website Access by Region — Lite
Version: 1.0
Description
Block Website Access by Region — Lite stops unwanted traffic at page load without slowing your site.
- Remote IP lookups (ipwho.is ipapi.co ipinfo.io) with automatic failover
- Country-level rules only—no logging, no U.S. state checks, no MaxMind DB
- Customizable heading and body text via constants (
BSAS_DEFAULT_BODY
,bsas_block_heading
) - Lightweight: one option group, no database tables, minimal transients
Need detailed logs, state-level blocking, a visual message editor, or a local GeoLite2 database? See the Pro edition.
External services
This plugin queries third-party IP geolocation APIs to detect a visitor’s country. For each request, it sends the visitor’s IP address to the provider and receives a two-letter country code and (when available) an ASN/organization string. Lite mode does not store per-visitor logs; only a short-lived transient cache of the country/ASN is kept to reduce API calls.
Providers used (in failover order), with terms and privacy:
1) IPWHOIS (endpoint: https://ipwho.is/) — Terms: https://ipwhois.io/terms — Privacy: https://ipwhois.io/privacy . :contentReference[oaicite:0]{index=0}
2) ipapi (endpoint: https://ipapi.co/) — Terms: https://ipapi.co/terms/ — Privacy: https://ipapi.co/privacy/ . :contentReference[oaicite:1]{index=1}
3) IPinfo (endpoint: https://ipinfo.io/) — Terms: https://ipinfo.io/terms-of-service — Privacy: https://ipinfo.io/privacy-policy . :contentReference[oaicite:2]{index=2}
Installation
- Upload the plugin folder to
/wp-content/plugins/
or install through Plugins Add New Upload. - Activate Block Website Access by Region — Lite.
- Go to Settings Block Website Access and tick the countries you wish to block.
- Visitors from blocked countries immediately receive a 403 page.
Faq
Lite mode never writes logs; it relies on short-lived transients for geo-lookups.
Yes. The plugin first checks HTTP_CF_CONNECTING_IP
and falls back to standard proxy headers or REMOTE_ADDR
.
Typical country-level accuracy is high; Pro can use a local MaxMind GeoLite2 database to improve resilience if APIs fail.
Edit the constant in the main plugin file:
define( ‘BSAS_DEFAULT_BODY’, ‘Access from {COUNTRY} is restricted.’ );