屏蔽隐藏WordPress默认登录页面

最近发现有很多用户通过默认注册登录页面进行注册登录,不安全也不方便。

//让用户访问自带登陆页面时直接跳转到指定页面
if (!function_exists('login_protection')) {
    function login_protection()
    {
        //这里是可以自定义一共路径/index.php/login
        if ($_GET['superuser'] != 'password') header('Location: /index.php/login');
        //当然你也可以禁止所有人访问,也就是直接跳转/index.php/login
        //header('Location: /index.php/login');
    }
    add_action('login_enqueue_scripts','login_protection');
}

 

搜索