Change the text for username in login and password reset

This function will change the original text for username in login and password reset with any custom text.

Make sure to:

  • change the text in $new_text on line 7, 13, 19 and 25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Change the text for username in login and password reset
 */
 
function wppb_change_text_login( $translated_text, $text ) {
   $original_text = 'Invalid username.';
   $new_text = 'Invalid user ID.';
   if ( $text == $original_text ) {
      $translated_text = $new_text;
   }
 
   $original_text = 'Username';
   $new_text = 'User ID.';
   if ( $text == $original_text ) {
      $translated_text = $new_text;
   }
 
   $original_text = 'Please enter your username or email address.';
   $new_text = 'Please enter your user ID or email address.';
   if ( $text == $original_text ) {
      $translated_text = $new_text;
   }
 
   $original_text = 'Username or E-mail';
   $new_text = 'User ID or E-mail';
   if ( $text == $original_text ) {
      $translated_text = $new_text;
   }
   return $translated_text;
}
add_filter( 'gettext', 'wppb_change_text_login', 30, 3 );