How to hide the default WP-admin?

2019-06-0119:52:36 评论

As we know, the wp-admin is the default entrance of your wordpress site, obviously if you do not hide it, the others can easily knock the door which means it's at least not that comfortable. Then what can we do ? Just like this as below:

Step 1: in Xftp,find the file "functions.php" in /home/wwwroot/example.com/wp-content/themes/example theme", download it and make a copy. Open it with tools such as Notepad++

Note: please replace the "example.com" 、“example theme" with your own ones.

Step 2: add these codes to the end of the "functions.php" and save it.

/**
 * try to protect the wp-admin
 */

add_action('login_enqueue_scripts','login_protection');  

function login_protection(){  

   if($_GET['knock'] != 'the door')header('Location: https://www.google.com/');  

}

Step 3: upload the new "functions.php" to its original place and replace the old one, now you can only visit the wp-admin by the address "www.yourdomain.com/wp-login.php?knock=the door", of course the others can not guess it easily.

Note: please replace the "knock" 、"the door" 、"https://www.google.com" with what you like.

  • A+
所属分类:WP
avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: