Skip to content

How to block specific IPs in WordPress

This post will explain how to block specific IPs in WordPress or allow access only to specific IPs to the management screen

How to completely block specific IP access to your WordPress site

IP blocks can be easily implemented by rewriting the HTACCESS file. HTACCESS file is installed at the top of the installation folder of WordPress.

The method of describing the IP blocking, depending on the version of server software called Apache.
To check the version of Apache on your server, write the following code in a text editor and name it info.php, upload it to the server via FTP, and access via browser to this file url. It will show you the version of Apache.

<?php phpinfo(); ?>

Apache 2.2

Order allow,deny
Deny from all
deny from 111.111.111.111
deny from 222.222.222.222

Apache 2.4

Require all granted
Require not ip 111.111.111.111
deny from 222.222.222.222

* Rewrite the parts such as 111 and 222 with the IP address you want to be blocked.

How to allow only specific IP computers to access the management screen in WordPress

If you want to allow access only to a specific IP to improve security access to the wordpress management screen will be described in the HTACCESS file as follows.

<Files wp-login.php>
Order Deny,Allow
Deny from all
Allow from 111.111.111.111
Allow from 222.222.222.222
</Files>

* Rewrite the parts such as 111 and 222 with the IP address you want to be blocked.

Easy IP Block with WordPress Doctor Malware Scanner & Security Plug-in

With WordPress Doctor Malware Scanner & Security , you can easily block IP from WordPress administration screen.

Once the plug-in is installed and activated, access to from the left menu> Malware Scanner and enter the IP you want to be blocked on the IP block tab and press the Save button at the bottom of the configuration.