Docs

Block countries and whitelist IPs

4 min readUpdated November 19, 2026

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#

  1. Go to Settings → Login Shield and open the Geo tab.
  2. Make sure Block login form by country is on.
  3. Under Country blocklist, choose Use a custom list at login (select below). The country picker appears.
  4. Select the countries to block.
  5. Click Save geo settings.
A settings interface displays a list of 101 blocked countries, each represented by its flag icon and a two-letter country code. Below header buttons for various regions, a dense grid of rectangular buttons lists nations alphabetically, from Afghanistan to Zimbabwe.

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.

  1. Open the Lockout tab.
  2. Find Whitelisted IPs.
  3. Enter one IP address or range per line.
  4. 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) or 2001:db8::/32 (IPv6)
Two text input fields for network configuration, titled “Blocked IPs” and “Whitelisted IPs.” Each field contains sample IP addresses in a list format, with brief instructional text below each box explaining the rules for entries.

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:

  1. Is your own country in the list? If it is, remove it, or whitelist your own IP first.
  2. Do you use a VPN? Your login may come from a different country than you expect.
  3. Is your IP whitelisted, or NAHNLS_BYPASS_IP set? Do this before you save.
  4. Do you use a service (a monitoring tool, a mobile app, a team member abroad) that logs in from another country? Whitelist its IP.
  5. 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?

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only