Skip to content
Launch offer 50% off your first year of Keel Pro. See prices →

Country blocking on WordPress: when it helps and when it backfires

Blocking whole countries removes a lot of attack traffic, and can also block customers, Google and payment providers. How to use it safely, starting with the login only.

Keel team · · 2 minutes read

Look at the failed logins on almost any WordPress site and you see addresses from all over the world. If your customers are in two or three countries, blocking the rest is tempting. Done carefully, it works well. Done bluntly, it blocks people and services you need.

What country blocking does well

  • Removes background noise: a large share of automated login attempts and scans come from countries where a local business has no visitors.
  • Reduces load on small hosting plans that are busy answering bots.
  • Makes logs readable: fewer blocked attempts means the ones that remain stand out.

What it does not do

It is not a wall. Attackers rent servers and use proxies in every country, including yours. Country blocking stops the cheapest, laziest attacks; it does not replace strong passwords, two-factor login and updates.

How it can backfire

  • Search engines: Google, Bing and others crawl from many countries. Blocking the whole site in the wrong country can stop them from reading your pages.
  • Payment providers and services: Stripe, PayPal, shipping and booking services send callbacks from their own servers, which may be abroad.
  • Customers who travel, live abroad, or use a VPN or a mobile network that routes through another country.
  • Your own team on holiday.

The safe way: block the login, not the site

Most of the benefit comes from protecting the login. Everyone can still read and buy; logins from other countries are refused. This avoids every problem above except your travelling team, which is solved with an allow list.

With Keel Pro, in Keel › Firewall › Countries:

  1. Choose allow only the countries you tick (simplest for local businesses), or block the countries you tick.
  2. Tick countries, or a whole region at once.
  3. Set Where it applies to only the login.

The country comes from Cloudflare when the site uses it, otherwise from the free DB-IP database, downloaded monthly. Visitors whose country cannot be found are always allowed, so a gap in the database never locks anyone out.

When blocking the whole site makes sense

  • Intranets, staff portals and client areas that only people in known places use.
  • Sites that legally may only serve some countries.
  • Sites under a sustained attack from a few countries, as a temporary measure.

In those cases, add your payment providers’ and other services’ addresses to the Always allow list.

Before you switch it on

  1. If the site is behind Cloudflare or a proxy, set the visitor IP source first, or every visitor looks like they come from the proxy’s country.
  2. Add your office and home addresses to Always allow.
  3. Make sure you can still log in another way when travelling: a VPN with an exit in your country, or a login link.

Common questions

Will blocking countries hurt my Google rankings?

Not if you only block the login. Blocking the whole site in a country Google crawls from can stop it from reading your pages.

How accurate is IP-based country detection?

Accurate for most home and business connections, less for mobile networks, VPNs and some cloud providers. That is why unknown countries should always be allowed.

Should I block countries or just use a firewall?

Both. Country rules remove noise; the firewall, login limits and two-factor login handle attacks from anywhere.

Keel does this for you.

Speed, security and SEO in one WordPress plugin, with plain-language settings. Free on any number of sites.

Get Keel free

Five minutes from now

Give your site a keel.

Steady when traffic spikes, calm when attacks come, found when people search. Start free; go Pro when a site needs more.