How To Remove WordPress Password Reset Option


How To Remove WordPress Password Reset Option

WordPress Login page has a Password reset / change option for Administrators. But this option can be annoying when users are playing with it every day. I have seen some visitors who use this WordPress password reset option to request password change every day just for a desire to create a problem for blog Admin. I don’t know which type of pleasure they get by doing this type of activities.
I searched on internet and got a method of removing that WordPress password reset/change option from wordpress. And this method works for me, now I don’t need to worry about these problems. This method works with a code which will be added to your wordpress blog, as a plugin and will be installed. If you don’t need this functionality in future then you can remove this plugin and simply, your Password reset option will appear again.

Removing WordPress Password Reset Option:

1. Create a new PHP file and name it whatever you like. ( example: password-reset-removed.php)
2. Paste the following code in it and save it.
{code type=php}
<?php
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();
?>
{/code}
3. Upload this file to your blog’s plugin’s directory using FTP.
4. Now go to Plugins list in your wordpress blogs and install this new plugin. After installation this plugin will remove the WordPress password reset option for other users.
Share on Google Plus

About Chathura

    Blogger Comment
    Facebook Comment