We will explain how to block certain IPs in WordPress or allow only certain IPs access to the admin panel, for example.

How to completely block access to specific IPs in WordPress

IP blocking can be easily achieved by rewriting the htaccess file, which is probably located at the top of the WordPress installation folder. (Reference article: Where is htaccess in WordPress, how to create it, and how to set up redirects )

The way to write the IP block depends on the version of the server software called Apache.
To check the version of Apache on your server, enter the following code in a text editor and name it info.php, then upload it to the server via FTP and access it with a browser.

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
Require not ip 222.222.222.222

Please replace 111, 222, etc. with the IP addresses you wish to block access to.

How to allow access to the administration page of WordPress only for computers with a specific IP address.

To allow only specific IPs to access the login screen to improve security, please follow the instructions below.


Order Deny,Allow
Deny from all
Allow from 111.111.111.111
Allow from 222.222.222.222

Please replace 111, 222, etc. with the IP addresses you wish to allow access to.

Easy IP Blocking with WordPress Doctor Malware Scanner & Security

WordPress Doctor Malware Scan ner & Security, developed by WordPress Doctor and used by over 2,000 websites in Japan, allows you to easily block IP addresses from the WordPress administration screen.

After installing and activating the plugin, go to the left menu of the administration screen > Malware Scanner > IP Block tab, enter the IP you wish to block, and click the Save Settings button at the bottom.