Home >CMS Tutorial >WordPress >Disable WordPress password reset feature
By default, WordPress allows users to change passwords via email reset. Sometimes you may want to disable this password reset feature. The following column WordPress Tutorial will introduce to you how to disable the WordPress password reset function. I hope it will be helpful to friends in need!
You can add the following code to the current theme function template functions.php:
function disable_password_reset() { return false; } add_filter ( 'allow_password_reset', 'disable_password_reset' );
After adding the above code, on the reset password page, click "Get new password" will prompt: This user's password cannot be reset.
However, since the password reset function has been disabled, there is no need to display the "Forgot your password?" link button on the login page.
Without modifying the WordPress program file wp-login.php, then add:
function hide_password_reset() { ?> <style> #nav a:nth-child(2) { display: none; } .login #nav { width: 30px; height: 20px; margin: 24px auto 0; overflow: hidden; } </style> <?php } add_action('login_head', 'hide_password_reset');
Use the above code to hide the "Forgot your password?" link button and the middle separator "|"
The above is the detailed content of Disable WordPress password reset feature. For more information, please follow other related articles on the PHP Chinese website!