为了wordpress网站的安全,最好是修改wordpress的默认后台登陆地址,主要有以下方法来修改wordpress的默认后台登陆地址。
1.通过插件修改
在wordpress中有许多插件可以修改wordpress默认后台的路地址。在这里推荐几款给大家。
Theme My Login
Settings WPS Hide Login
Limit Login Attempts
由于插件安装越多的话会对服务器产生负担,不推荐大家直接安装插件。
2.通过修改function.php文件
找到主题文件夹中的function.php文件,增加以下代码:
add_action('login_enqueue_scripts','login_protection');
function login_protection(){
if($_GET['login'] != 'test') header('Location: http://www.yuchen2021.top');
}
只有我们在要打开的后台中http://www.yuchen2021.top/wp-login.php?login=test网站才能登录,不然会跳转到http://www.yuchen2021.top首页中。