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!

up vote 3 down vote accepted

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.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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