How to Remove the Password Reset / Change option from WordPress

144

Are you looking to remove the password reset option in WordPress? By default, WordPress allows users to reset/change password by providing their email address. Sometimes you may want to disable password reset option in WordPress. In this article, we will show you how to remove the password reset / change option from WordPress.

Removing password reset option from WordPress

Why Remove Password Reset/Change Option From WordPress

If you allow user registration on your WordPress site, then password reset option allows user to recover lost passwords. Normally, you wouldn’t want to change that.

However, in some usage scenarios you may want to remove this option for specific users or user roles on your WordPress site.

For example, if you have created a temporary account for someone or if you have created a demo site where users can login with a demo username and password.

The easier solution will be to just remove the password reset link. But some savvy users may already know the URL to access the password reset form.

Having said that, let’s see how you can easily remove password reset/change option from WordPress.

Method 1: Disable Password Reset/Change Option Using Plugin

The plugin method is better and easier. It allows you to disable password reset option for specific user roles or even individual users.

This way you can still control and provide password reset feature for some trusted users or user roles.

First thing you need to do is install and activate the Plainview Protect Passwords plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Settings » Protect Passwords page to configure the plugin settings.

Protect password settings

Simply select the user roles or individual users to disable their password change or reset option.

There is also an option to exempt individual users. This option is useful if you want to disable password reset option for all users except yourself.

Don’t forget to click on the save changes button to store your settings.

You can see the plugin in action by visiting the WordPress login page and clicking on ‘Lost your password?’ link. It will take you to the password reset page where you can try entering the username or email address for a user who does not have password reset option.

You will see an error indicating that password reset is not allowed for this user.

Password reset disabled for this user

Method 2: Manually Disable Password Reset Option From WordPress

This method requires you to add code to your WordPress site. It is not recommended for beginner level users.

First thing you need to do is open a blank text file using a text editor like Notepad. Paste the following code inside this file.

  <?php  /*   * Plugin Name: Disable Password Reset   * Description: Disable password reset functionality. Only users with administrator role will be able to change passwords from inside admin area.    * Version: 1.0   * Author: WPBeginner   * Author URI: http://wpbeginner.com   */     class Password_Reset_Removed  {      function __construct()     {      add_filter( 'show_password_fields', array( $this, 'disable' ) );      add_filter( 'allow_password_reset', array( $this, 'disable' ) );      add_filter( 'gettext',              array( $this, 'remove' ) );    }      function disable()     {      if ( is_admin() ) {        $userdata = wp_get_current_user();        $user = new WP_User($userdata->ID);        if ( !empty( $user->roles ) && is_array( $user->roles ) && $user->roles[0] == 'administrator' )          return true;      }      return false;    }      function remove($text)     {      return str_replace( array('Lost your password?', 'Lost your password'), '', trim($text, '?') );     }  }    $pass_reset_removed = new Password_Reset_Removed();  ?>  

Save this file as disable-password-reset.php on your desktop.

Now you need to upload this file to your WordPress site. You will need an FTP client to do that. See our guide on how to use FTP to upload WordPress files.

Connect to your website using the FTP client and then go to the plugins folder. The plugin’s folder is located inside /wp-content/ directory.

Plugins folder on a WordPress site

Upload disable-password-reset.php file from your computer to the plugins folder on your WordPress site.

Now you need to login to your WordPress admin area and visit the plugins page. You will notice a new plugin titled ‘Disable Password Reset’ in your list of installed plugins. Click on the activate link below the plugin.

Activate Disable Password Reset plugin

That’s all, activating the plugin will disable password reset option for all users including administrators. Administrators will be able to change passwords from the admin area, but they will not be able to reset password from the login screen.

We hope this article helped you learn how to remove the password reset/change option from WordPress. You may also want to see our list of 13 plugins and tips to improve WordPress admin area.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.