Block countries and whitelist IPs
This topic covers the two lists that control who gets past geo-blocking: the countries you block, and the IPs that are always allowed through, wherever they are.
Choose the countries to block#
- Go to Settings → Login Shield and open the Geo tab.
- Make sure Block login form by country is on.
- Under Country blocklist, choose Use a custom list at login (select below). The country picker appears.
- Select the countries to block.
- Click Save geo settings.

If you leave the option on No country filtering at login, nobody is blocked, even with the main switch on. The picker is hidden in that mode. A list you chose earlier stays saved, but it isn’t used.
Using the picker
The picker shows every country as a button with its flag, its two-letter code and its name. Click a country to select it. Click it again to deselect it. Selected countries are highlighted. A counter above the grid shows how many countries are currently blocked.
Above the grid are quick buttons that add a whole region at once:
- China & Russia
- Africa
- Europe
- North America
- South America
- MENA (Middle East and North Africa)
- Asia
- Oceania
Click a region button to select every country in it. The button changes to a minus sign (for example “- Europe”), and clicking it again removes the whole region. Clear all deselects everything. You can add a region and then deselect individual countries you don’t want.
Nothing is saved until you click Save geo settings.
Block, or allow only?
Shield’s list is a blocklist. There is no “allow only these countries” mode. If your visitors all come from one or two countries, you’ll need to select every other country you want to block. The region buttons make that quicker, for example by adding every region and then deselecting your own country.
Whitelist IPs so they’re never blocked#
Whitelisted IPs skip the country check. Use the whitelist for yourself, your team, your office, or a service that logs in from another country.
- Open the Lockout tab.
- Find Whitelisted IPs.
- Enter one IP address or range per line.
- Save the Lockout settings.
Each line can be one of:
- A single IPv4 address, like
203.0.113.25 - A single IPv6 address, like
2001:db8::25 - A CIDR range, like
203.0.113.0/24(IPv4) or2001:db8::/32(IPv6)

The whitelist is shared by all of Shield’s protections. A whitelisted IP is also never locked out and is never stopped by the IP blocklist. It isn’t an exemption from two-factor authentication.
Shield also always allows the server itself (local addresses such as 127.0.0.1), so your own server’s background tasks keep working.
The NAHNLS_BYPASS_IP constant
The whitelist lives in the dashboard, so you have to be able to log in to change it. If you set a block and can’t sign in, wp-config.php offers a way back in:
define( 'NAHNLS_BYPASS_IP', '203.0.113.25' ); You can list several IPs or ranges, separated by commas. IPs listed here skip the country check, lockouts and the IP blocklist, but not 2FA. The older name NLS_BYPASS_IP still works. See “I locked myself out” in the Troubleshooting section.
Before you save a block#
Run through this checklist so you don’t lock yourself out:
- Is your own country in the list? If it is, remove it, or whitelist your own IP first.
- Do you use a VPN? Your login may come from a different country than you expect.
- Is your IP whitelisted, or
NAHNLS_BYPASS_IPset? Do this before you save. - Do you use a service (a monitoring tool, a mobile app, a team member abroad) that logs in from another country? Whitelist its IP.
- Open a private window on another network (for example your phone’s mobile data) afterwards and test that the login still works.
Known limits#
- The country list only affects people who haven’t been whitelisted. It never applies to IPs on your whitelist.
- The region buttons are shortcuts, not exact definitions. They put certain countries together, for example MENA overlaps with Africa and Asia. If a country matters, check that it’s highlighted in the grid.
- The list is saved as plain two-letter country codes. Codes that aren’t valid are dropped when you save.
Was this helpful?
Thanks for your feedback!
✓ Feedback received. Thank you!