3

I want to change the password hint on the password reset screen. Currently, it says "Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & )."

I've identified the location of the hint text in the user.php file. This is the code block:

function wp_get_password_hint() {
     $hint = __( 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).' );

     /**
      * Filter the text describing the site's password complexity policy.
      *
      * @since 4.1.0
      *
      * @param string $hint The password hint text.
      */
     return apply_filters( 'password_hint', $hint );
}

I want to use a plugin to update the hint text (becuase I'm under the impression that modifying core Wordpress files is not a great idea.)

Thanks!

1 Answer 1

5

Just add a filter, where you can change the text, like this:

add_filter( 'password_hint', function( $hint )
{
  return __( 'MY OWN PASSWORD HINT' );
} );

This can be added in functions.php in your theme.

A bit of an explanation
there in core you can see:

return apply_filters( 'password_hint', $hint );

that is where the function will be applied.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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