How to Ban IP Address WordPress
24/7 Sales & Support.  Call 1300 863 436 Click to Call
The sexy world of
hosting & domains

How to Ban IP Address WordPress


Banning a particular IP address for a site achieves very little. If you are trying to keep spammers away, a single IP address won’t aid your cause to a great degree. That’s because anyone who is determined enough will easily change their IP. Blocking a range of addresses and user agents, or the number of requests placed within a certain time period might be more beneficial. There is, however, a situation where you can block an IP address, such as when a commenter is consistently violating your terms and agreements.

These unruly characters that use profane language, attack users, or peddle their own self-seeking agendas are all very familiar. And they are neither bots nor spiders. If your commenting system is the native one provided by WordPress, they can change the name they use to appear as if they are different people. Only you can see if they are the same person through the backend by reviewing their IP address.

Chances are these people won’t go so far as changing their IPs if you block them out. Any threats you might give quickly be disregarded. WordPress allows you to moderate these comments through its moderation system, but when you want to keep them out completely, here is how you can do so.


This method is uncomplicated as it needs no plugins or code adjustments. If you can access your file system, access file might offer the most convenient way of blocking them out. If there is a particular comment from an IP address you want to keep out, here is how:

Open the .htc access, and place these lines in the beginning.

Order allow, deny

Deny from

Allow from all

Once you save the file, visitors from that specific address will be locked out, as long as the above instructions remain active.


WordPress has a variety of security plugins that enable you to perform various security tasks. These tools can allow you block IP addresses. Many of them are very intuitive, and all you have to do is to key in the address you want to keep out.

Temporary Banning

IP addresses are inherently dynamic in that they change from time to time. For this reason, banning a particular address for good is not recommended as it might be assigned to someone else down the line. Temporary blocks are therefore more ideal as they forestall such kind of a situation. The ‘Ban System by IP and Country’ is one good plugin that you can use for this. Once installed, the bottom left side has a dashboard and configuration screen. Click on the ‘Add’ Tab and ban the specific address for the duration that you would like. A one month ban often suffices, as the ‘trolls’ are unlikely to wait around for that long.

Recommended for you

$534m stolen from Japanese exchange in world's biggest cryptocurrency theft

Tokyo-based cryptocurrency exchange Coincheck, Inc. is under government scrutiny after it was subject to a…

Read more

This Is Not A Drill: Facebook Has Invented a New Unit of Time

Facebook has taken an enormous step in its pursuit of world domination. It was announced…

Read more

4 Reasons Why You Should Be Using a VPN

If you're like most people, you've probably already used a VPN to see if the…

Read more