How to Block IP Address in WordPress
What is an IP Address?
Have you ever wanted to block IP address in WordPress? The reason is a lot of spam comments, hackers trying to hack into your WordPress site. If you want to block these let us see how to block IP address in WordPress.
An IP address is the physical address of a device connected to the computer.It is from this IP address that your location on the internet is traced.You can compare it to your home address where you live. It is the home address of a computer connected to the internet. It is in the form of numbers.It is grouped into 4 groups like
“241.196.251.16”
Your IP Address gets stored in the raw access logs of your website.All the websites have their visitor’s IP addresses recorded in the raw IP access logs.So why do we need to block IP addresses in WordPress?Let us see the reasonsfor the same.
Reasons for Blocking IP address in WordPress
One of the reasons could be receiving a lot of spam comments. So you could block these IP addresses from sending you any more comments. Another major reason could be the brute force attack. It is the case where an unlimited amount of login attempts are being made to your WordPress site from hackers.so to prevent those you can block the IP address.
How to find the IP address in WordPress?
You can find the IP address in the following ways.
1. Click on the comments section in the WordPress Admin dashboard.
2. Check the author column for the IP address. It is mentioned there with other details.
Another way is to check the raw access logs of your WordPress site.It can be accessed from the cPanel provided by your hosting provider.
1. Open the cPanel of your hosting account.
2. Click on Advanced—>Raw Access.
Download the ZIP file from there and unzip it with a tool like 7zIP. Open the login in notepad. You will see the list of IP addresses that have visited your site.
How to block IP address?
The First way is through WordPress comment moderation.
Click on Settings–>Discussion. Go to the Disallowed comment keys section.
Mention one IP address per line. Each IP address is to be mentioned in a new line.
The second way is through your hosting provider’s IP blocker feature.If you navigate to your cPanel, you will find the IP blocker function.Go to the security section and click on the IP blocker.Enter IP address and click on Add.
The third way is through the htaccess file. You can block IP addresses in the following way through .htaccess.Open Your CPanel and go to File Explorer.Navigate to the public_html folder and edit the .htaccess file as follows.
Order Allow, Deny
Deny from 112.145.245.86
Allow from all
Click on save and it’s done. Now the entered IP address in Deny field won’t be allowed.
The Fourth way is to use a firewall security plugin. You can check from one of the below popular and most used plugins.
It identifies and blocks malicious traffic.Its real-time IP blocklist blocks all the requests from the most malicious IPs.It protects from brute force attacks and has a firewall rule and malware scanner.It has 4 million+ active installations and has a 5-star rating.
It protects against brute force attacks. It allows IP blocking. It is lightweight. It has 1 million+ active installations and has a 5-star rating.
It provides several security features like login security. It allows IP blocking.
Also, you can hide your IP address by using a VPN service. A VPN service hides your original IP address by routing it through their servers.
Please let me know your views and how you hide or block IP in WordPress in comments section below.