There are situations where you may find malicious users accessing or spamming your WordPress blog.

In such cases, you may have to restrict access to such visitors. There comes IP address blocking.

Since every device or source on the Internet is assigned with an IP address, you can block that specific user by their IP address.

However, there are still situations where you may want to block a specific country permanently from visiting your WordPress site. That means every visitor from that specific country will be blocked.

Few reasons for blocking a specific country visitors.

  • Your business may be irrelevant to a specific country and hence you want to block all those visitors coming from that country.
  • You find a lot of spammers from a specific country and you want to restrict that country visitors.
  • You find a specific country of visitors are useless to your WordPress site and they are neither converting or unnecessarily occupying your bandwidth.

In all those cases, you can block a specific country as a blacklist.

In this article, I will take you through those steps to blacklist all IP addresses from a country.block visitors by country in WordPress

Steps to restrict a specific country IP addresses.

  1. Login to WordPress dashboard.
  2. Go to Plugins – Add New.
  3. Search for “ip geo block”.
  4. Click Install Now and then Activate.
  5. Once Installed, go to Settings – IP Geo Block.
  6. Select Matching rule as Blacklist.
  7. Enter country code at Blacklist of country code.
  8. Check all the options of “Block by country“.
  9. Finally, click Save Changes.
  10. Done.

The following screenshots shows the steps:block list of specific countries

The advantage of this method is that you have completely blocked all the visitors coming from that specific country.

You can check the county code list here in order to configure this plugin.block by country selection

Finally, don’t forget to Save Changes.Save country list

In case, if you want to restrict access to specific IP address then the best method is directly controlling it from your web hosting provider.

  • The easiest method, you can contact your web hosting provider and ask them to block the bad IP address (of course, you have to send them the list of IP addresses to block).
  • For SiteGround users, you can simply use the IP address deny manager and block all the bad IP addresses so that you can strict access to your WordPress site.

Most of the time, it is the spammers who add unwanted comments to your WordPress blog.

In such cases, I would recommend you to install a plugin like Akismet which helps to readily block all spam commenters coming to your blog.

At the same time, Akismet moves all spam comments to the spam folder and using WP spam comments you can automatically clean all blocked comments in order to avoid database bloating.

Let me know, how do you block IP addresses from a specific country? Your answer may help other WordPress users also.

2017-12-18T12:13:14+00:00

About the Author:

I love-to-code, passionate-to-write, an upcoming author, and WordPress enthusiast. Here at BlashO, I mostly share WordPress tips. Connect with me @Twitter.

Leave A Comment