How can you edit the labels of the wp-login.php
form?
I am using emails for logins, so I need to change username
to email
.
The answer here seems to be out of date, or just doesn’t work with SSL or something: Function to change a label (Username) in a core WordPress File (wp-includes/general-template.php)
I tried this in my functions file, but it didn’t work:
function wpse60605_change_username_label( $defaults ) {
$defaults['label_username'] = __( 'Email' );
return $defaults;
}
add_filter( 'login_form_defaults', 'wpse60605_change_username_label' );
4 Answers
Found this here: https://wordpress.org/support/topic/how-to-change-the-text-labels-in-userpass-box-on-login-page/
The other answer here didn’t work for me, but this one did.
Just in case this helps anyone.
add_filter( 'gettext', 'register_text' );
add_filter( 'ngettext', 'register_text' );
function register_text( $translated ) {
$translated = str_ireplace(
'Username or Email Address',
'Your Custom Text',
$translated
);
return $translated;
}