Blocking access to your WordPress admin area is a great way to improve the security of your WordPress site. It also helps reduce the load from brute force attempts that slow down your website load time. All you need to to enable this feature it paste some text by editing the .htaccess file.
To block access to your WordPress admin portal, you need to add the following to your .htaccess file:
# set up rule order
# default deny
deny from all
# Thexyz Office Ranges
allow from 10.10.4.0/23
allow from 10.20.4.0/22
allow from 10.20.7.0/24
allow from 10.30.4.0/2
allow from 10.30.2.0/24
allow from 10.30.104.0/24
# Add additional IPs for access here
You just need to change the numbers in red to your own IP.
You can find your IP address here.
To further secure your WordPress site, take a look at the complete list of .htaccess snippets to improve WordPress security.