WordPress security – Hide and protect the WP admin background login wp-login.php

We can also restrict access or hide this login entry based on the security of the account username and password.

Some plugins have this capability, and some plugins such as Limit Login Attempts can be set to limit the number of logins, and if more than a certain number of times, access is restricted.

But plug-ins this way will have a certain impact on the performance of the site.

So, how do you not use plugins to achieve login entry restrictions?

It can be solved by modifying the function.php file.

add_action('login_enqueue_scripts','login_protection');

function login_protection(){
	if($_GET['admin'] != 'root') {
		header('Location: https://www.linuxcommands.site/');
	}
}

Add the above method in the function.php file. You need to use the following URL parameter to log in to the WP website later:

http://www.linuxcommands.site/wp-login.php?admin=root

If the URI admin parameter is incorrect or there is no admin parameter, the browser will jump to www.linuxcommands.site/

Add a Comment

Your email address will not be published. Required fields are marked *