• Get In Touch
April 20, 2018

How To Block IP Addresses In WordPress

Using Wordpress? Get our lightening fast Wordpress Optimised Hosting.
Get Wordpress Hosting

IP Address blocking is a security measure that prevents a connection between a specific or group of IP addresses and a mail, web or Internet server. This is usually done to ban or block any undesirable sites and hosts from entering the server or node and causing harm to a network of individual computers. IP blocking is usually used by companies and websites to prevent intrusion, block spam and protect against hacking attacks

In this article, we will demonstrate how to block IP addresses within WordPress and also how to identify the necessary IP addresses to block.

Identifying The IP Addresses You Want To Block

There might be several instances when you will want to discover a certain IP address in order to block it. If someone is leaving spam comments on your page then you can head over to the “Comments” tab on the left-hand sidebar of WordPress Admin page. You will be able to see full details of including the IP address of any commenters.

If you find that your website is under an attack, for example, a DDOS attack, then the best way to locate the offending IP address is to head to your servers access log. You will need to login to the cPanel dashboard of your WordPress Hosting account and locate the ‘Logs’ section. Once there, click ‘Raw Access Logs’.

You will be redirected to the access logs page where your next step is to click on your Domain Name to download the access log file.

Once you have extracted the file by clicking on it, you will be shown your access log file. The best way to view this is with a plain text editor such as Notepad.

All the raw date of requests being made to your website are logged here, with each line beginning with the IP Address making that request.

We recommend copying any suspicious IP address and using this online IP lookup tool before you block any IP addresses, as you wouldn’t want to inadvertently block legitimate users. You want to check for IP addresses with an unusually high number of requests.

Once you have located any offending IP addresses, copy and paste them into a separate Notepad file.

Block IP Addresses In WordPress

If all you want to do is stop a specific IP address from leaving comments on your WordPress site, just head to the ‘Settings > Discussion’ page and scroll to the “Comment Blacklist” box. Paste any IP addresses you want to be blocked in this box and they will no longer be able to leave comments on your website.

Blocking An IP Address With cPanel

This method completely blocks an IP address from accessing or viewing your website. You should use this method when you want to protect your WordPress site from hacking attempts and DDOS attacks.

First, you need to login to cPanel dashboard of your hosting account. Now scroll down to the security section and click on the ‘IP Address Deny Manager’ icon.  This will take you to the IP Address Deny Manager tool. Here you can add the IP addresses you want to block. You can add a single IP address or an IP range and then click on the add button.

Come back here to unblock any IP addresses.

Using Wordpress? Get our lightening fast Wordpress Optimised Hosting.
Get Wordpress Hosting

Share this Article!

Related Posts

5 Website Hosting Solution Trends for 2022 and Beyond

5 Website Hosting Solution Trends for 2022 and Beyond

Looking for the right web hosting solution for your website can be an intimidating task. Options nowadays are more diversified than ever, and each year brings new developments in the web hosting market. If you have no clue of what to look out for, you can find yourself overwhelmed with the choices. Hence, you must […]

64 Content Marketing Statistics Demonstrating the Power of Content

64 Content Marketing Statistics Demonstrating the Power of Content

Content marketing continues to be one of the most valuable tools for today’s online businesses. With content, you can improve your chances of reaching your target audience, boost your search engine standing, and even unlock new opportunities for sales. The more content you produce, the more you can strengthen your domain authority, demonstrate your thought […]

53 User Experience Stats for 2022

53 User Experience Stats for 2022

User Experience (UX) is one of the most crucial factors to consider in web design. As the number of websites and applications in the world today continues to accelerate, businesses are under more pressure than ever to impress customers straight away. If a user visits your website and finds slow-loading pages, clunky navigation, or errors, […]

How to increase the memory limit in WordPress

How to increase the memory limit in WordPress

Do you need to increase the memory limit in WordPress? Getting an error about memory Exhausted? The memory limit is one of the most common WordPress errors as the default limit of memory in WordPress is only set to 64mb! But there’s good news! The Memory Exhausted error is one of the easiest to fix […]

All in One WordPress Migration Vulnerability

All in One WordPress Migration Vulnerability

A vulnerability has been discovered in the “All In One WordPress Migration” WordPress plugin. All versions earlier than, and including 6.97 contain a vulnerability which allows Cross-Site Scripting (XSS). With over 2 million active installations, this vulnerability has the potential to be high impact, however, this is lessened by the nature of the vulnerability, which […]