X

How to Disable the Password Reset Feature in WordPress

Snippets by IsItWP

Wondering how to disable the password reset feature in WordPress? Adding this snippet to the functions.php file will disable the password reset feature from the login page. If a user tries to reset their password from the login page, then an error message will be shown: “Password reset is not allowed for this user”.

Instructions:

All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

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

If you want to remove the Lost your password? text from the login page, just go ahead and add this snippet to your functions.php file, instead of the above snippet.

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

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: Best WordPress Page Builders (Compared).

Comments  Leave a Reply

  1. 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;}

  2. Nice works, thanks for sharing

  3. Worked, thanks.

  4. fake

  5. Same here…doesn’t work

  6. Doesn’t work… I added it to my theme’s functions.php file and the link is still there.

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!