Home > Article > CMS Tutorial > How to prevent specific users from changing passwords in WordPress
How WordPress prohibits specific users from changing passwords
In some special circumstances, it may be necessary to prohibit users from using WordPress The built-in password reset function is to click "Forgot your password?" on the login interface to retrieve your password:
If you want to prohibit all users from using this function, you can add it in the theme's functions.php The following code:
add_filter('allow_password_reset', '__return_false' );
If you only prohibit certain users from using this function, you can add the following code to the theme’s functions.php:
add_filter('allow_password_reset', 'no_reset', 10, 2 ); function no_reset( $bool, $user_id ) { $ids = array( 3, 10 ); // 要禁止的用户ID if ( in_array( $user_id, $ids ) ) return false; return true; }
Recommended tutorial: WordPress Tutorial
The above is the detailed content of How to prevent specific users from changing passwords in WordPress. For more information, please follow other related articles on the PHP Chinese website!