Beautifulthemes Blog

WordPress News, Trends, Tutorials and Information

WORDPRESS TIPS AND TRICKS

How to block an IP Address in WordPress: Step-by-Step Guide For Beginners

Last Updated: 7 mins By: BeautifulThemes Author

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.

How_to_block_an_IP_address_in_WordPess-comments_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.

How_to_block_an_ip_address_in_WordPress-Discussion_settings

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.

How_to_block_an_IP_address_in_WordPress-Cpanel-block

The next page lets you enter an IP and once you click on Add it’ll completely block off this IP.

How_to_block_an_IP_address_in_WordPress-Cpanel-IP_enter_Cpanel

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

how_to_block_an_IP_address_in_WordPress-Cpanel-Ip_ban_plugin

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.

Key features:

  • Highly effective and easy to use
  • Lets you ban IP ranges
  • Allows external redirection for banned IPs

Download + Demo + Details

IP blacklist cloud

How_to_block_an_IP_address_in_WordPress-Cpanel-Ip_ban_plugin2IP 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.

Key features:

  • 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

Download + Demo + Details

 

IP blocker lite

How_to_block_an_IP_address_in_WordPress-Cpanel-Ip_ban_plugin3

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.

Key features:

  • 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.

Download + Demo + Details

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.

How_to_block_an_ip_address_in_WordPress-ip_blacklist_plugin

Then click on the Add IP to Blacklist listing under the plugin to add an IP Ban.

How_to_block_an_ip_address_in_WordPress-ip_add

You can simply enter the IP in the text box and click on Add IP to ban an IP from accessing your website.

How_to_block_an_IP_address-Cpanel-add_ip_ban

Similarly, you can use the Add User to Blacklist feature to block a username to the Blacklist.

How_to_block_an_ip_address_in_WordPress-add_user

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.

Note:

If you want to disable the “Protected by IP Blacklist Cloud” message that is shown in the comments form after installing the plugin, you can use the plugin Settings to disable this.

First, click on Settings under the IPBlackist section and find an option that says Show “Protected with IP Blacklist cloud” message.

Then disable it by using the drop-down option and selecting “No”. Click on Save changes and now this message should now disappear on your comment forms.

 

How_to_block_an_ip_address_in_WordPress-comments_message

Wrapping up

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:

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top

Pin It on Pinterest