Home > CMS Tutorial > WordPress > body text

Disable WordPress password reset feature

藏色散人
Release: 2019-11-01 11:43:18
forward
2280 people have browsed it

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!

Disable WordPress password reset feature

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' );
Copy after login

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(&#39;login_head&#39;, &#39;hide_password_reset&#39;);
Copy after login

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!

Related labels:
source:zmingcx.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!