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?
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;
}
}