Do you want to block specific IP addresses that access your WordPress website?

Blocking IP addresses is used as a solution for block spam attacks as well as hacking on your website or blog.

In this tutorial, we will show you how to block IP addresses on WordPress, and we will also show you how to know which IP addresses should be blocked.

If you have never installed WordPress, discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog

How to block ip addresses on wordpress e1566163574833

What is an IP address?

If the Internet was a physical world, consider IP addresses such as country, street, and house number. They are essentially composed of 4 sets of numbers of 0-255 separated by dots and similar to this: 172.16.254.1

Each computer connected to the Internet has an IP address assigned to it by the ISP.

All visitors to your website have an IP address which is stored in your website access log files. This means that all the websites you visit also store your IP address.

You can hide this information using a VPN service . This allows you to hide your IP address and other personal information.

Why and when do you have to block IP addresses?

Blocking an IP address from accessing your website is an effective way to deal with unwanted visitors, spam, spam, hacking attempts, and DDOS (denial of service) attacks.

Discover How to protect yourself while blogging on WordPress

The most common sign that your website is under a DDOS attack is that your website will often become inaccessible or your pages will take a long time to load.

Make your blog fast by discovering How to make a blog fast: with WordPress plugins

Other attacks are more obvious, like when you start getting a lot of spam from your Contact form.

We have a list of ways to fight against anti-spam comments, but the last solution is to block IP addresses.

How to find the IP addresses you want to block on WordPress

WordPress stores an IP address for users who leave a comment on your website. You can see their IP address by visiting the comments page in your WordPress dashboard.

Wordpress dashboard ip address

If your website is experiencing a DDOS attack, the best way to locate the IP addresses is to check the access log of your server.

To view these logs, you need to log into the cPanel dashboard of your WordPress hosting account. Next, find the " Logs "And click on the" Raw Access Logs ».

Cpanel access log

Which will bring you to the Access Logs page where you need to click on your domain name to download the Access Logs file.

Download access logs

Your access log file will be in a .gz archive file. Go ahead and extract the file by clicking on it. Inside the archive you will see your access log file which you can open in a simple text editor, like Notepad ou TextEdit.

The access log file contains raw data of all requests made to your website. Each line begins with the IP address that makes this request.

Wordpress Access File

You need to make sure that you don't end up blocking yourself, legitimate users or search engines won't accept your website. Copy a prospective IP address and use online IP research tools to learn more about it.

You will need to carefully review your access logs for an unusually high suspicious number of requests originating from a particular IP address.

Once you have located these IP addresses, you must copy and paste them into a separate text file.

Blocking IP addresses on WordPress

If you simply want to prevent users with a specific IP address from leaving a comment on your website, you can do so in your WordPress dashboard.

Meeting on " Settings> Chat And scroll to the "Comment blacklist" text box.

Blacklist for comments

Copy and paste the IP addresses you want to block, then click on the " Save Changes ».

WordPress will now block users with these IP addresses and they will no longer be able to leave comments. These users will still be able to visit your website, but they will see an error message when they try to submit a comment.

Here too Some tips to secure your WordPress blog

Blocking an IP Address Using cPanel

This method completely blocks an IP address so that it can no longer access your website. You must use this method when you want to protect your website or blog against hacking attempts and DDOS attacks.

First, you need to login to the cPanel dashboard of your account.Web hosting. Then scroll down to the section Security and click on the " IP Address Deny Manager ».

Ip address deny manager cpanel

This will take you to the IP address blocking management 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 the " Add "(Add).

Add ip address to block cpanel

You can return to the same page if you need to unblock these IP addresses.

Here is ! Now you can block some IP addresses on your WordPress blog.

Discover also some themes and premium WordPress plugins  

You can use other themes and WordPress plugins to give a modern appearance and to optimize the handling of your blog or website.

Here are some premium WordPress plugins and themes that will help you do that.

1. Uber Chat

UberChat is a WordPress Plugin which allows you to instantly communicate with Uber customers right on your WordPress website. The modern and easy to use interface is very intuitive and allows your visitors to contact you whenever they need. 

Uberchat wordpress plugin for livechat

Its features are among others: one-time fees, an unparalleled live-chat experience, a nice, modern and customizable appearance, support for multiple operators, a responsive layout, several sound notifications to choose from, a history completeness of previous discussions and inquiries and other

Download | DemoWeb hosting

2. ConvertPlus

ConvertPlus is a WordPress Plugin all-in-one that turns your website into a powerful lead generation module. In particular, it allows you to create your own email list, bigger, faster and more targeted than ever.

popup plugin wordpress convertplus

You can create beautiful popups in minutes and start converting your visitors into subscribers, followers and customers.

Among its features we find among others:read from 10 places for displaying the popup, p100 themes, pvideo opups, popups of social networks, fintegrated ormals, Widgets, binformation arres etc ...

Download | Demo | Web hosting

3. Advert Flap Pro

Advert Flap Pro is an animated ad management plugin for WordPress websites. This is one of the most effective ways if you want to get an ad or advertisement to your website visitors without however using popups.

Wordpress advert flap pro plugin

It folds down to the bottom of the screen for visitors to notice, then waits to be clicked. The visitor can close the ad at any time or remove it from the screen. Creating ads is as simple as choosing your style, entering your text, and previewing your ad. Once you are satisfied, choose the pages on which you want to display or hide them and click publish. As simple as that!

It works on all modern browsers and is perfect for special offers, sales notices, item promotions, customer reviews. cookies, important news, new products, and more ...

Download | Demo | Web hosting

Recommended Resources

Find out about other recommended resources to help you build and manage your website.

Conclusion

Here is ! That's all for this tutorial, I hope it will allow you to block IP addresses on WordPress. If you liked it, don't hesitate to share with your friends on your favorite social networks

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.

But, in the meantime, tell us about your Comments and suggestions in the dedicated section.

...