How to Block IP Address in WordPress

How to Block IP Address in WordPress
Do you want to block IP address in WordPress of bad visitors or spam traffic from your WordPress website? keep reading this post, When a user is spamming, invalid clicks or copying content on your site, then the best option is to block that user’s IP address so that they cannot visit your site again. If you are on Shared hosting and if your website is victim of brute force attack then you hosting provider may ban or terminate you hosting account to protect another user so it is strongly recommended from my end you should not ignore it. Today in this article I will explain to you how to block IP address in WordPress.

How to Block IP Address in WordPress-:

If you want to block a visitor from your WordPress site, then you can block their IP address and prevent them from visiting the site. By blocking Spam traffic, you can save Bandwidth of your site. Here I will tell you three easy methods to block the IP address so let’s start

1. Block IP Address in WordPress using .htaccess File-:

How to Block IP Address in WordPress

You can easily block an IP address by editing your htaccess file. If you do not know how to edit .htaccess file, you can read this article: How to edit .htaccess file in WordPress site to block any IP address from the website, add the IP address to your .htaccess file. This way,

order allow, deny
deny from 104.24.117.129
allow from all

If you want to block a lot of IP addresses on your WordPress site, then deny from [IP address], adding one after the other.

order allow, deny
deny from your IP address
deny from your IP address
deny from your IP address
deny from your IP address
allow from all

note: Do not add IP Address in between # BEGIN WordPress and  # END WordPress

2. Block IP Address in WordPress using LionScripts Plugin-:

How to Block IP Address in WordPress

As this plugin not up to date but works very fine. The LionScripts plugin helps block spam visitors and bad IP addresses on your WordPress website. This plugin allows you to block IP addresses in two ways – Block IPs Manually and Upload IP Address (CSV Format) First, install and activate the LionScripts plugin on your site. After activating the plugin, click on LionScripts >> IP Address Blocker and add IP Address. Then click on the Save Changes button to store your settings. Now, this plugin will block the IP address you have added.

How to Block IP Address in WordPress

using this plugin you can block unlimited IP addresses. you can note down IP addresses in a Excel file and upload it for bulk blocking of IP. This Plugin is also able to block Suspicious account activity and Auto Blocking of Brute Force attack. Hackers do the brute-force login attacks very often to gain the access to your website, which may become a negative signal to the shared hosting service provider for your website, leading to the account suspension too, if not taken care of very soon.

3. Block IP Address in WordPress using cPanel-: 

How to Block IP Address in WordPress

This is also a very easy way to block an IP address from a WordPress website. Simply, log into your web hosting cPanel. Then go to the Security section, then click on IP Blocker. Now add the IP address you want to block from your website and then click on the Add button. You can successfully spam using your cPanel from your WordPress website. IP is blocked.

If you like my work, Please Share on Social Media! You can Follow WP knol on FacebookTwitterPinterest and YouTube for latest updates. You may Subscribe to WP Knol Newsletter to get latest updates via Email. You May also Continue Reading my Recent Posts Which Might Interest You.

About Amar Patel 263 Articles
Hi, I am Amar Patel from India. Founder, Author and Administrator of wpknol.com. I am a Simple Average Man who Loves life and Love living life.Professionally I am a Mechanical Engineer. Apart from my Job, I Love to write the things around WordPress WordPress CMS.