修改WordPress后台地址的目的非常简单,就是防止一些比较无聊的用户登录站点后台,并且尝试各种账号密码,虽然这些举措不能从根本阻止这些情况的发生,但是至少从某些层面上面达到一定的效果。
想要实现的方式分两种:安装插件和使用代码
插件方法
Protect Login Page
插件描述:This is a simple plugin that protects access to your Wordpress website's login page by intercepting the page request and requiring that a PIN num …
这里插件比较多,我推荐一个名为:Protect Login Page的插件,文末会有相关介绍,插件界面如下:
代码方法
1 2 3 4 5 6 7 |
//保护后台登录 add_action('login_enqueue_scripts','login_protection'); function login_protection(){ if($_GET['word'] != '自定义关键词'){ header('Location: 设定跳转的地址'); } } |
代码中的自定义挂件此和设定跳转地址都是可以自定义的内容,最终设定的效果如下:
1 2 3 4 5 6 |
add_action('login_enqueue_scripts','login_protection'); function login_protection(){ if($_GET['word'] != 'xueyuan'){ header('Location: https://www.wpxsxy.com/'); } } |