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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *