1

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?

0

I've managed to find why I couldn't change the error message. For some reason, our old dev has put a login_error_override() in Theme's Function (function.php from theme).

After commented the function call, my custom error worked perfectly, as well the original error messages from theme, wordpress and plugins.

//add_filter('login_errors', 'login_error_override');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.