WordPress 移除忘记密码链接

WordPress 移除忘记密码链接

有很多人利用 WordPress 的忘记密码功能攻击网站的服务器或邮箱,当你的网站没开放注册的时候,完全可以移除这个忘记密码链接,只需要将下边的代码添加到当前主题的 functions.php 即可隐藏这个链接。

/**
    *WordPress 移除忘记密码链接
    *https://www.endskin.com/remove-lostpassword-text/
*/
function netnote_remove_lostpassword_text( $translations, $text, $domain ){
    if( $text == 'Lost your password?' && $domain == 'default' ) return;
    return $translations;
}
add_filter( 'gettext', 'netnote_remove_lostpassword_text', 10, 3 );

 

原文来自:https://www.endskin.com/remove-lostpassword-text/