How to modify WordPress backend without plugins
How to modify WordPress backend without plugins
The default background login address of WordPress is http://www.domain.com/wp-login.php or http://www.domain.com/wp-admin. Not changing the default login address in the background is actually very dangerous. Brute force cracking provides powerful conditions. This article shares how to change the default login address in the WordPress backend.
Method 1: Modify the code
Advantage: Say goodbye to plugins that don't drag down your blog.
method:
1. Find the functions.php file of the current theme, remember it is the current theme, the path is generally: root directory/wp-content/themes/your theme/functions.php
2. Copy the following code to the functions.php file
//Protect background login
function login_protection(){
if($_GET['word'] != 'xxx')header('Location: https://www.xxxx.com/');
}
add_action('login_enqueue_scripts','login_protection');
//Note: xxx is your own character name.
//Protect background login
function login_protection(){
if($_GET['word'] != 'xxx')header('Location: https://www.xxxx.com/');
}
add_action('login_enqueue_scripts','login_protection');
After copying, saving, uploading, and overwriting, how to use it?
Note: You need to modify the URL and keywords in the above code.
Taking the above code as an example, when I enter the original login address https://www.lanmitu.com/wp-login.php, it will return to the blog homepage;
When I log in using the link https://www.xxxx.com/wp-login.php?word=xxx with the keyword, the login entry is returned.
You can try it. Before modifying, it is recommended to make a backup to avoid mistakes.
Method 2: Modify the wp-login.php login file
For example, we changed the login address of the WordPress backend to http://www.domain.com/wp-xxx.php
method:
1. We need to rename the wp-login.php file in the root directory to wp-xxx.php;
2. Replace all wp-login.php in the original wp-login.php file with wp-xxx.php.
ok, your WordPress blog background login default address has been changed.
You can choose the above two methods by yourself, and Blue Rice Rabbit recommends the second method.
Post a Comment
0 Comments