Remove the WordPress Reset Lost Password Link on Login Page

To remove the reset ‘Lost Your Password‘ link and function on the WordPress login page you need to add a function to your themes functions.php file and add in some CSS.

The reason why both are needed as the forgot ‘Lost Your Password‘ link appears in 2 areas as a link in the bottom of the dialog box and also as an error dialog box.

wordpress-lost-password-page-link
The first link is at the bottom of wp-login.php, add in the function below to your themes functions.php file to remove it.

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

 

This will remove the link, but an error dialog is displayed if the incorrect values are used in the username/password fields.

If you wanted to change the words instead just add your text in the single quotes which are blank in the above code.

wordpress-lost-password-page-link-error

 

You can hide this by adding in some CSS in wp-admin.css add in the code below to /public_html/wp_admin/css/wp-admin.css:

#login_error {display: none;}

Thats it – that link should now be hidden from view.

Leave the first comment