{"id":375959,"date":"2026-09-29T15:12:34","date_gmt":"2026-09-29T15:12:34","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/geo-lockdown\/"},"modified":"2026-09-29T14:14:00","modified_gmt":"2026-09-29T14:14:00","slug":"codecaste-country-access-control","status":"publish","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/codecaste-country-access-control\/","author":15832969,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.1","stable_tag":"1.0.1","tested":"7.1.2","requires":"5.8","requires_php":"7.4","requires_plugins":null,"header_name":"Country Access Control by CodeCaste","header_author":"Code Caste","header_description":"Restrict website access by visitor country using a local IP geolocation database. No external APIs required.","assets_banners_color":"","last_updated":"2026-09-29 14:14:00","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/www.codecaste.com\/","header_author_uri":"https:\/\/codecaste.com","rating":0,"author_block_rating":0,"active_installs":0,"downloads":64,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.1":{"tag":"1.0.1","author":"codecaste","date":"2026-09-29 14:14:00","revision":3719235}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3719232,"resolution":"128x128","location":"assets","locale":"","width":128,"height":128},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3719232,"resolution":"256x256","location":"assets","locale":"","width":256,"height":256}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.1"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3719232,"resolution":"1","location":"assets","locale":"","width":676,"height":1024},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3719232,"resolution":"2","location":"assets","locale":"","width":1024,"height":714},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3719232,"resolution":"3","location":"assets","locale":"","width":1024,"height":639},"screenshot-4.png":{"filename":"screenshot-4.png","revision":3719232,"resolution":"4","location":"assets","locale":"","width":1024,"height":248},"screenshot-5.png":{"filename":"screenshot-5.png","revision":3719232,"resolution":"5","location":"assets","locale":"","width":921,"height":1024},"screenshot-6.png":{"filename":"screenshot-6.png","revision":3719232,"resolution":"6","location":"assets","locale":"","width":763,"height":1024}},"screenshots":{"1":"Full settings screen \u2014 General rules, blocked response, safety bypasses, performance, diagnostics, and GeoIP database status","2":"General \u2014 enable Country Access Control, choose allow\/block mode, select countries, and set the blocked visitor response","3":"Safety and Bypass \u2014 administrator bypass, Cloudflare support, system bypasses, Googlebot verification, and trusted proxies","4":"Performance and Logging \u2014 Cache TTL, blocked-request logging, and log retention","5":"Diagnostics \u2014 current IP, detected country, lookup timing, final decision, and Test IP tool","6":"GeoIP Database \u2014 download the latest free DB-IP Country Lite dataset and clear the lookup cache"}},"plugin_section":[],"plugin_tags":[1912,3751,242487,4124,600],"plugin_category":[49,54],"plugin_contributors":[282440],"plugin_business_model":[],"class_list":["post-375959","plugin","type-plugin","status-publish","hentry","plugin_tags-access-control","plugin_tags-country","plugin_tags-geo-blocking","plugin_tags-geolocation","plugin_tags-security","plugin_category-maps-and-location","plugin_category-security-and-spam-protection","plugin_contributors-codecaste","plugin_committers-codecaste"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/codecaste-country-access-control\/assets\/icon-128x128.png?rev=3719232","icon_2x":"https:\/\/ps.w.org\/codecaste-country-access-control\/assets\/icon-256x256.png?rev=3719232","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/codecaste-country-access-control\/assets\/screenshot-1.png?rev=3719232","caption":"Full settings screen \u2014 General rules, blocked response, safety bypasses, performance, diagnostics, and GeoIP database status"},{"src":"https:\/\/ps.w.org\/codecaste-country-access-control\/assets\/screenshot-2.png?rev=3719232","caption":"General \u2014 enable Country Access Control, choose allow\/block mode, select countries, and set the blocked visitor response"},{"src":"https:\/\/ps.w.org\/codecaste-country-access-control\/assets\/screenshot-3.png?rev=3719232","caption":"Safety and Bypass \u2014 administrator bypass, Cloudflare support, system bypasses, Googlebot verification, and trusted proxies"},{"src":"https:\/\/ps.w.org\/codecaste-country-access-control\/assets\/screenshot-4.png?rev=3719232","caption":"Performance and Logging \u2014 Cache TTL, blocked-request logging, and log retention"},{"src":"https:\/\/ps.w.org\/codecaste-country-access-control\/assets\/screenshot-5.png?rev=3719232","caption":"Diagnostics \u2014 current IP, detected country, lookup timing, final decision, and Test IP tool"},{"src":"https:\/\/ps.w.org\/codecaste-country-access-control\/assets\/screenshot-6.png?rev=3719232","caption":"GeoIP Database \u2014 download the latest free DB-IP Country Lite dataset and clear the lookup cache"}],"raw_content":"<!--section=description-->\n<h4>The issue we kept running into<\/h4>\n\n<p>On client sites, \u201cblock visitors from these countries\u201d sounds simple \u2014 until you look at how most tools do it. Many geolocation plugins phone home on every request, or they lean on a third-party lookup API. That means extra latency, another service in the critical path, and a privacy story that is harder to explain to a client.<\/p>\n\n<p>We also saw the other failure mode: the rule looks correct in settings, but a full-page cache (LiteSpeed, WP Rocket, Cloudflare HTML cache, host caching) keeps serving a previously allowed page to someone who should be blocked \u2014 or the reverse.<\/p>\n\n<h4>What we think about it<\/h4>\n\n<p>Country access control has to be local-first. The decision for a visitor should happen on <em>your<\/em> server, against data you control, without a round trip to an external API on every page view.<\/p>\n\n<p>And because the response depends on <em>who<\/em> is visiting, page caching cannot treat every visitor as if they got the same HTML. If your cache layer ignores that, geo rules will look broken even when the plugin logic is fine.<\/p>\n\n<h4>Why we built this<\/h4>\n\n<p>Country Access Control (the product we also call Geo Lockdown) is our answer for WordPress shops that need country allow\/block rules without shipping visitor IPs to a lookup API at runtime.<\/p>\n\n<p>Lookups run against IP range data stored in your site\u2019s MySQL\/MariaDB tables. You choose when to refresh that data. Admin, login, and common WordPress endpoints stay reachable so you do not lock yourself out while testing.<\/p>\n\n<h4>What you get<\/h4>\n\n<ul>\n<li>Allow-list or block-list country modes with a searchable country selector<\/li>\n<li>Local IPv4 and IPv6 IP-to-country lookups (no external API call while enforcing)<\/li>\n<li>MySQL\/MariaDB storage \u2014 no PHP SQLite3 extension required<\/li>\n<li>Administrator bypass to help prevent lockouts<\/li>\n<li>Automatic bypass for wp-admin, wp-login.php, REST API, AJAX, WP-Cron, and XML-RPC<\/li>\n<li>Verified Googlebot bypass using reverse DNS and forward confirmation (User-Agent alone never bypasses)<\/li>\n<li>Configurable trusted proxy \/ CDN headers, with Cloudflare connecting-IP validation against official Cloudflare ranges<\/li>\n<li>Custom blocked message (403) or redirect to a URL you choose<\/li>\n<li>Optional blocked-request logging<\/li>\n<li>IP lookup cache with configurable TTL, plus a one-click Clear Lookup Cache action<\/li>\n<li>Diagnostics panel and a Test IP tool so you can see what the plugin decides before you go live<\/li>\n<li>Optional one-click download of the free DB-IP Country Lite dataset, imported through staging tables and an atomic swap<\/li>\n<\/ul>\n\n<h4>How to use it<\/h4>\n\n<ol>\n<li>Install and activate the plugin.<\/li>\n<li>Go to <strong>Settings \u2192 Country Access Control<\/strong>.<\/li>\n<li>Open the Diagnostics panel and confirm the detected IP looks right (especially if you use Cloudflare or another proxy).<\/li>\n<li>Click <strong>Download Latest Database<\/strong> so you are not relying on the limited starter dataset in production.<\/li>\n<li>Choose Allow or Block mode, select the countries, set the blocked response, then enable Country Access Control.<\/li>\n<li>Save settings, then purge your site\/page cache (see below) and test from a real visitor perspective \u2014 private\/incognito while logged out is the easiest check.<\/li>\n<\/ol>\n\n<h4>Things to take care of (please read this)<\/h4>\n\n<p><strong>1. Download a full GeoIP database before you trust the results<\/strong><\/p>\n\n<p>The plugin ships with a small starter dataset so it activates cleanly. That is enough to explore settings \u2014 not enough for production accuracy. Use <strong>Download Latest Database<\/strong> under the GeoIP Database panel. Nothing about your site or visitors is sent; only the public CSV file is fetched when an administrator clicks the button.<\/p>\n\n<p><strong>2. Page caching and CDNs<\/strong><\/p>\n\n<p>When Country Access Control is enabled, the plugin marks front-end responses as non-cacheable for common cache plugins (including LiteSpeed Cache, WP Rocket, and WP Super Cache style APIs) and purges those caches when you save settings.<\/p>\n\n<p>That still does not cover every stack. If your host, CDN, or another plugin caches full HTML at the edge, you can get stale allow\/block decisions until that cache is cleared or told not to cache HTML for the public site.<\/p>\n\n<p>After you enable the plugin or change countries \/ response settings:<\/p>\n\n<ul>\n<li>Purge the page cache in LiteSpeed, WP Rocket, W3 Total Cache, WP Super Cache, SiteGround Optimizer, or whatever you use<\/li>\n<li>If Cloudflare (or another CDN) caches HTML, purge that cache too \u2014 or exclude the public HTML pages from cache while geo rules are active<\/li>\n<li>Use <strong>Clear Lookup Cache<\/strong> in the plugin sidebar if you just updated the GeoIP database and want fresh lookups immediately<\/li>\n<\/ul>\n\n<p>If rules still look wrong after a purge, open Diagnostics, run a Test IP, and confirm the detected IP \/ country before digging into theme or security-plugin conflicts.<\/p>\n\n<p><strong>3. Proxies, Cloudflare, and real visitor IPs<\/strong><\/p>\n\n<p>If the site sits behind Cloudflare or another reverse proxy, enable Cloudflare support and\/or configure trusted proxies and the correct connecting-IP header. Otherwise the plugin may see the proxy IP instead of the visitor, and country decisions will be wrong.<\/p>\n\n<p><strong>4. Do not test blocks while logged in as an administrator<\/strong><\/p>\n\n<p>Administrator bypass is on by default (and wp-admin \/ wp-login are always bypassed). Turn administrator bypass off only while testing, and use a private window while logged out.<\/p>\n\n<p><strong>5. Honest limitation<\/strong><\/p>\n\n<p>This is IP-to-country mapping, not a GPS check. VPNs, proxies, Tor, and similar tools can present an IP from another country. No IP-only system can guarantee a person\u2019s physical location.<\/p>\n\n<h3>External services<\/h3>\n\n<p>This plugin can optionally connect to one external service, <strong>DB-IP<\/strong> (db-ip.com), solely to let you download an updated GeoIP dataset.<\/p>\n\n<p><strong>What it is and what it's used for:<\/strong> DB-IP publishes a free, monthly-updated \"IP to Country Lite\" CSV database under a Creative Commons Attribution 4.0 license. When you click <strong>Download Latest Database<\/strong> under <strong>Settings \u2192 Country Access Control<\/strong>, the plugin fetches that public CSV.GZ file directly from <code>https:\/\/download.db-ip.com\/<\/code> and imports it into your site's own database. Country lookups for your visitors always run locally afterward \u2014 DB-IP is never contacted while your site is actually enforcing geo-restrictions, only when an administrator explicitly requests a database update.<\/p>\n\n<p><strong>What data is sent:<\/strong> Nothing about your site, its visitors, or their IP addresses is sent to DB-IP. The request is a plain HTTP GET for a public, static file; no query parameters, cookies, or identifying data are included.<\/p>\n\n<p><strong>When it's used:<\/strong> Only when an administrator manually clicks \"Download Latest Database.\" It never runs automatically, on a schedule, or in the background.<\/p>\n\n<p>Service links: <a href=\"https:\/\/db-ip.com\">db-ip.com<\/a> \u00b7 <a href=\"https:\/\/db-ip.com\/db\/download\/ip-to-country-lite\">Free Lite database &amp; license terms<\/a><\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>codecaste-country-access-control<\/code> folder to <code>\/wp-content\/plugins\/<\/code><\/li>\n<li>Activate the plugin through the <strong>Plugins<\/strong> menu<\/li>\n<li>Go to <strong>Settings \u2192 Country Access Control<\/strong><\/li>\n<li>Download the latest GeoIP database, choose Allow or Block mode, select countries, then enable Country Access Control<\/li>\n<li>Purge your page\/CDN cache and verify with Diagnostics \/ a logged-out browser session<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"does%20this%20plugin%20call%20an%20external%20api%20for%20every%20visitor%3F\"><h3>Does this plugin call an external API for every visitor?<\/h3><\/dt>\n<dd><p>No. Country lookups run against your local MySQL\/MariaDB data. The only documented external connection is the optional, administrator-triggered DB-IP database download.<\/p><\/dd>\n<dt id=\"will%20page%20caching%20break%20country%20blocking%3F\"><h3>Will page caching break country blocking?<\/h3><\/dt>\n<dd><p>It can, if a full-page or CDN cache serves the same HTML to every visitor. The plugin asks common WordPress cache plugins not to store those responses and purges them when settings change \u2014 but you should still purge host\/CDN caches after enabling or changing rules. See \u201cThings to take care of\u201d above.<\/p><\/dd>\n<dt id=\"does%20this%20require%20the%20php%20sqlite%20extension%3F\"><h3>Does this require the PHP SQLite extension?<\/h3><\/dt>\n<dd><p>No. GeoIP data is stored in MySQL\/MariaDB tables, which every WordPress site already uses.<\/p><\/dd>\n<dt id=\"can%20i%20update%20the%20ip%20database%3F\"><h3>Can I update the IP database?<\/h3><\/dt>\n<dd><p>Yes. Click <strong>Download Latest Database<\/strong> under <strong>Settings \u2192 Country Access Control<\/strong> to fetch the current free DB-IP Country Lite CSV.<\/p><\/dd>\n<dt id=\"will%20i%20lock%20myself%20out%20of%20wp-admin%3F\"><h3>Will I lock myself out of wp-admin?<\/h3><\/dt>\n<dd><p>No. wp-admin and wp-login.php are always bypassed. Logged-in administrators can also bypass restrictions by default.<\/p><\/dd>\n<dt id=\"will%20googlebot%20be%20blocked%20outside%20the%20allowed%20countries%3F\"><h3>Will Googlebot be blocked outside the allowed countries?<\/h3><\/dt>\n<dd><p>Not when <strong>Allow verified Googlebot<\/strong> is enabled (default). Crawlers are verified by reverse DNS hostname and forward confirmation back to the same IP. A spoofed Googlebot User-Agent alone does not bypass the geo block.<\/p><\/dd>\n<dt id=\"does%20it%20support%20cloudflare%20or%20reverse%20proxies%3F\"><h3>Does it support Cloudflare or reverse proxies?<\/h3><\/dt>\n<dd><p>Yes. Trusted proxy\/CDN headers can be configured, and Cloudflare source ranges are validated before those headers are trusted.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Fix: Redirect response type failed silently for bare-domain URLs (e.g. https:\/\/www.google.com\/) because the loop-prevention check treated their empty path as \"no URL configured\"<\/li>\n<li>Fix: Redirect response type used wp_safe_redirect(), which blocks any target outside the site's own domain; switched to wp_redirect() since the URL is admin-configured<\/li>\n<li>Fix: \"HTTP 403 with message\" and \"Custom message (403)\" incorrectly shared the same message field; each option now behaves independently<\/li>\n<li>Removed manual CSV database upload feature; database updates now go only through Download Latest Database<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"Restrict front-end access by visitor country using a local IP database. No external APIs are used at runtime.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/375959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=375959"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/codecaste"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=375959"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=375959"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=375959"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=375959"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=375959"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=375959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}