Remove the lost your password? link

Yesterday I posted a snippet to disable the lost password feature in wordpress. This will add to that little snippet and remove the lost password text from the wordpress login page. This does not remove the link but just replaces the Lost your password? text with nothing effectively removing the link.

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

Comments  Leave a Reply

  1. Hi Kevin,

    This code snippet is not working in my case. I need to get rid of the lost password link for my website. I have added the code to theme’s function.php. Still its not working. Is it due to some different plugin interference ?

    1. Its hard to say if that is the case the only way to know would be disable all the plugins and see if things are working. Once things are working you can enable the plugins one by one to check and see what plugin caused the issue. This is a pretty simple snippet, so I would confirmed that you added this to the functions.php correctly.

  2. Hi Kevin, this is awesome. Having looking hi and low for this. How do I disable the ‘back to site’ link?

  3. This is EXACTLY what just saved my sanity! Can’t thank you enough!

  4. Thank you so very much!! Exactly what i was looking for 🙂
    Just for notes, code should be pasted at functions.php like Kevin said.

  5. Thank you Kevin. Great job.

    1. No problem glad I could help.

  6. Thanks Kevin, simple & clever  method!

    1. Glad you like the snippet, enjoy.

  7. Hi Kevin,
    I am unable to get this to work properly.  I am sure its me.  I am a noob to wordpress.  I added the code to the functions.php file and refreshed the login page an there was no change?  Any idea where I am going wrong?

    1. Hi, no problem if you wanted to paste the contents of your functions.php wthin http://pastebin.com and then post the url it sends in a comments I can take a look for you.

  8. Hi Kevin

    Tried this but after inserting the code into the functions.php file and reloading the login page it’s all gone. No background, no login form, nothing. Just white. No error message either. Do I really only have to copy your code and paste in? No special characters to place at the beginning or end?

    1. the location in the functions.php file does not matter however you want to make sure you place it after the first < ? other then that should be fine. If you still have problem you could post the file on http://pastebin.com/ and post the link in the comments and I can take a look at the file.

  9. P. Neamt Cultural June 4, 2011 at 2:06 pm

    And how to remove the lost pass text when you’re using WP in another language?

    1. If you change the text on line 2. called “Lost your password?” to what is displayed in another language that should work. Let me know if this works if not ill do a little digging for you.

      1. Hi there,

        I’ve tried to change line 2 in french unfortunately didn’t work.
        if ($text == ‘Mot de passe oublié ?’ )
        Any idea ?


        1. This made it just in case : ($text == ‘Mot de passe oublié ?’)

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!