在WordPress的一些开发场景中,不需要用户使用通过邮件重设密码,下面我们给出如何禁用找回密码功能。

WordPress中如何去除找回密码功能?

在主题的functions.php中(如何方便的在更新主题时保留 functions.php 里的自定义)添加如下代码

function disable_password_reset() { 
    return false;
}
add_filter ( 'allow_password_reset', 'disable_password_reset' );

WordPress如何在登陆页面中去除“忘记密码?”字样?

同样需要在functions.php中添加如下代码

function remove_lostpassword_text ( $text ) {
     if ($text == '忘记密码?'){$text = '';} 
        return $text; 
     }
add_filter( 'gettext', 'remove_lostpassword_text' ); 


评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注