At this moment, my WP site don’t require a minimum length for password recovery, and I want to change that. Since I’m really new at WP plataform, I’ve been searching for a while, and find some methods to add a minimum length here in the Stack Exchange, like this and this. However, this solution worked only parcialy. Am I doing something wrong? I tried to add the following code in wp-login.php and in a custom plugin.
function se_password_min_length_check( $errors, $user){
if(strlen($_POST['pass1']) < 12)
$errors->add( 'password_too_short', 'ERROR: password is too short.'
);
}
add_action( 'validate_password_reset' , 'se_password_min_length_check' 10, 2
);
With this code, the password isn’t changed with less than 12 chars, but is showing the following error:
Invalid User or Password. To retrieve your password, click here. If necessary, contact us at contact@email.com.
So, my question is: how to change both the minimum length of the password and the error warning when the number of characteres is above the minimum?