How to remove the ‘forgot your password?’ link on your WordPress login page

A guide to making your WordPress website a little more secure by getting rid of the ‘forgot your password?’ link/text (highlighted in red) that by default will appear on the login page:

login1

The solution is very simple and was originally discovered at this following site:

http://wpsnipp.com/index.php/functions-php/remove-the-lost-your-password-link/

To summarize, all the webmaster has to do is locate the functions.php file and insert the following code snippet:

function remove_lostpassword_text ( $text ) {
         if ($text == 'Lost your password?'){$text = '';}
                return $text;
         }
add_filter( 'gettext', 'remove_lostpassword_text' );

And that is it!

Log in to your WordPress dashboard and select Appearance > Editor:

login2

And then locate the ‘functions.php’ file so that you can edit it:

login3

And paste in the php code snippet, I just inserted it right at the bottom:

login4

Once saved, the ‘lost your password?’ text will have disappeared when re-visiting the WordPress login page:

login5

To disable the allow password reset feature completely, also append the following php code snippet to your ‘function.php’ similar to previously:

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

Leave a Reply