找到当前主题的functions.php文件,复制下列代码,到functions.php文件中
//保护后台登录 function login_protection(){ if($_GET['word'] != 'laoli')header('Location: http://www.mylaoli.top/'); } add_action('login_enqueue_scripts','login_protection');
这样原登录地址https://www.mylaoli.top/wp-login.php和https://mylaoli.top/wp-admin,都会返回到网站首页,只有使用https://www.mylaoli.top//wp-login.php?word=laoli 带有关键词的链接登录时,才会返回登录入口。