WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a plugin that changes the password requirements to be a bit stricter, however wherever there is a password field to create a password, WordPress' hints are now no longer accurate (e.g. Password must consists of seven characters).

How can I replace those hints? Is there a filter/function that can help with this?

share|improve this question
up vote 1 down vote accepted

You can filter 'gettext'.

Sample code, not tested:

add_filter( 'gettext', 'wpse_65085_change_error_messages', 10, 3 );

function wpse_65085_change_error_messages( $translated, $text, domain )
    if ( 'default' !== $domain )
        return $translated;

    switch( $text )
        case 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).':
            return __( 'Use whatever you want', 'your_plugin_text_domain' );

        // more cases here.

            return $translated;
share|improve this answer
Perfect! Had to make some small adjustments, but pointed me in the right direction. – NightHawk Sep 13 '12 at 19:18
I noticed today that it didn't change the language on the password reset page. It still contains the old language, presumably because the plugin doesn't get loaded on that page? Do you have any thoughts on how I can change that there as well? – NightHawk Sep 14 '12 at 18:53
The plugin should be loaded there too. Not sure without seeing the code. – toscho Sep 14 '12 at 19:22
function change_password_hint ( $text ) {
    if(basename($_SERVER["SCRIPT_NAME"])=='wp-login.php' && $text == 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).'){
        $text = 'Here is your message.';
    return $text;
add_filter( 'gettext', 'change_password_hint' );
share|improve this answer
Answers should be more than a code snippet. Please improve your answer with an edit explaining why this would work. – Gabriel Sep 26 '15 at 22:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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