Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer 1

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.

        default:
            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
add comment

Your Answer

 
discard

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.