An IP address in layman’s term is how a user is identified on the internet. Every user on an ISP network has an IP address assigned to them and this is how they share information with other computers on the internet.
At times you might face issues with spammers, ruckus creating viewers or even DDOS attacks. Annoying users could also be an issue on your website in cases and simply banning or blocking their accounts is not the complete answer, as they can simply create a new account to work around this block.
So a great answer to solving individual user based problems or stopping spam bots is simply blocking their IP. Usually, this ensures that these viewers cannot comment or even view your website. Thus, we present to you this media enabled article that will teach you How to Block an IP Address in WordPress.
IP Blocking in WordPress
An IP address is 4 sets of digits(usually) that identify a viewer on your website. The IP addresses of a viewer are stored on your WordPress website’s log files. Without the use of a VPN, whenever a person views your website, their exact IP addresses can be retrieved by you through WordPress.
Retrieving an IP address
There are 2 steps required for blocking an IP in general. The first is retrieving the correct IP address and the next is implementing the block.
WordPress logs down every user that comments on your posts and notes down their username and Ip. For finding the required IP on WordPress, we can use this feature to our advantage.
First, we need to note down the users you want to IP block. For this, Simply check the Comments section through the dashboard. Click on the Comments listing in the WP Admin dashboard.
Now you can search the comments through the search button or manually scroll down to find the correct user. Then note down their IP ( we suggest you copy it if needs are.)
An alternative way of retrieving IP is using the log files which can read through cPanel. However, we do not recommend this for beginners, therefore, we will not be discussing this method as it can be quite tedious to find the correct user through it.
Similarly, you can also use various security plugins to find what IPs you want to ban. You can read about some of the best security plugins available on the market here.
Manually Blocking the IP
Now that we’ve retrieved the IP we want to block we can proceed with either blocking it from commenting or viewing the website.
There are 2 types of IP blocking you can implement manually on your website:
Blocking IP from Commenting
This is an inbuilt feature in WordPress that is very easy to enable. Simply hover over Settings in the Dashboard and click on Discussion. Then copy the IP you retrieved into the Comment Blacklist section.
Now every IP that matches the IPs u enter, will be automatically sent to trash instead of being posted.
This lets you block off annoying spam comments and more.
Blocking IP From viewing
This method lets you completely block off an IP from viewing anything on your website and is a great way to stop spam comment bots entirely.
For this, we use cPanel and its IP Blocker feature. Open your website’s Cpanel page after logging in and click on IP Blocker feature under Security.
The next page lets you enter an IP and once you click on Add it’ll completely block off this IP.
Furthermore, Cpanel also lets you define IP addresses in multiple ranges using ‘-‘, as well as blocks off any IP with a certain prefix such as 192*.* or typing in 192 only would block off any IPs that start with 192.
Blocking IP using a Plugin
You can also enable an IP block in an easier manner using various WordPress plugins as well. This is much easier as well as comes with less risk involved as some plugins ensure that you don’t block your own or some other required IPs when you ban them. Some of the Plugins we recommend are:
Simple IP Ban
This small but effective plugin lets you easily enter any IP, just as we did earlier to block it off. Thus this standalone IP ban plugin is quite effective at blocking off users and user agents from accessing your website.
You can also ban IP ranges and even define an external URL to which to the banned users will redirect to if they try to access your website using Simple Ip Ban.
- Highly effective and easy to use
- Lets you ban IP ranges
- Allows external redirection for banned IPs
IP blacklist cloud
IP blacklist cloud lets you easily blacklist users from viewing your website as well as commenting if needs are. Either freely blacklist IPs from accessing your website or block users from involving themselves in discussions on your posts using this amazing plugin.
The plugin also seconds as a database which lets you view how many IPs a user has been blocked off from to find out if it’s a Bot or not.
- Easy to use IP ban feature
- Allows you to block a user from commenting
- Lets you use the blocked IP database to find how many websites have blocked off a single IP
IP blocker lite
This IP block plugin made by LionscrIPs serves the same purpose as the plugins above with the added feature of manual method or bulk IPs upload method using CSV files.
Furthermore, you can use IP blocker lite to show a predetermined message or a blank page to blocked off users. The plugin also shows you your IP as well to ensure you don’t block yourself off accidentally as well.
- Lets you block off IPs manually or using CSV.
- The bulk method lets you easily block off many IPs at once.
- Shows a predefined message to blocked users.
Using the plugin:
To show a demonstration of how the plugin works, we’ll be using IP Blacklist cloud as its interface is very basic and easy to use. However, readers don’t need to fret over the process if they choose a different plugin as most of these plugins have a similar working process.
First of all, go ahead and install the plugin first, if you are not aware of how to do this, refer to here.
Once you have installed the plugin, you can access the IP Blacklist plugin through the Dashboard by clicking on IP Blacklist listing on the sidebar.
Then click on the Add IP to Blacklist listing under the plugin to add an IP Ban.
You can simply enter the IP in the text box and click on Add IP to ban an IP from accessing your website.
Similarly, you can use the Add User to Blacklist feature to block a username to the Blacklist.
In order to check what IPs you have blocked, you can check the IP Blacklist section. Similarly, User Blacklist section shows you the usernames you have blocked.
With these plugins and the preceding steps, you should be able to set up an IP ban for any user or IPs. These are great against online attackers, spammers, and spam bots and can help you secure your site better and provide a better experience for your readers overall.
An ending note entails the warning to ensure that you absolutely do not ban your IP. While some plugins inform you to whitelist your IP or do it automatically, it can be devastating to block off your own IP or username which might hinder your work a lot.
However, blocking IPs isn’t the only WordPress feature you can use to improve your website’s internet security and integrity. Some of the related articles on our websites are:
- How to enable WordPress SSL and HTTPS
- Manually updating WordPress
- How to password protect a WordPress Post or Page