Skip to content

Instantly share code, notes, and snippets.

@UltraSimplified
Last active November 24, 2022 17:27
Show Gist options
  • Save UltraSimplified/8ad1d1ca8ae57f3a7396cae16e247219 to your computer and use it in GitHub Desktop.
Save UltraSimplified/8ad1d1ca8ae57f3a7396cae16e247219 to your computer and use it in GitHub Desktop.
Override the standard WordPress password messages
/*
* Change the password reset text
*
**/
function change_password_reset_text_filter( $translated_text, $untranslated_text, $domain ) {
switch( $untranslated_text ) {
case 'Enter your new password below.':
$translated_text = __( 'A system generated password has been created for you. If you wish to use this, please make sure you store it somewhere safe.','text_domain' );
break;
case 'New password':
$translated_text = __( '<h3>Password</h3>To change this to something more personal and memorable, please type a new password in the box below.<br/><br/>','text_domain' );
break;
case 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).':
case 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! \" ? $ % ^ &amp; ).':
$translated_text = __( 'Please click Set Password when you are ready.<br/><br/>You will always be asked to enter your username and password when entering the site.','text_domain' );
break;
case 'Reset Password':
$translated_text = __( 'Set Password','text_domain' );
break;
case 'Your password has been reset.':
$translated_text = __( 'Your password has been set.' );
break;
case 'Lost your password?':
$translated_text = __( 'Click here to reset your password' );
break;
}
return $translated_text;
}
add_filter('gettext', 'change_password_reset_text_filter', 20, 3);
@Travis-A-Chapman
Copy link

Wow....This is amazing. Tipping my had to the people who made this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment