Would like to change

'label_username' => __( 'Username' ) on line 258 of wp-includes/general-template.php to 'label_username' => __( 'Username or Email' )

Changing core files is a not recommended --- never never

So any help to code a function to achieve this would really be appreciated.

  • why you want to do that? we can use filter to alter a function using that variable. – amit Aug 2 '12 at 11:10

Try putting this in your functions.php

function wpse60605_change_username_label( $defaults ){
    $defaults['label_username'] = __( 'Username or Email' );
    return $defaults;
add_filter( 'login_form_defaults', 'wpse60605_change_username_label' );
| improve this answer | |
  • Bravo! Works! and many many thanks to you and the other contributors – Valentine Cosgrave Aug 2 '12 at 11:48

You should hook to the gettext filter which is called by __() function on domain translated text with the untranslated text as second parameter.

Take a look at how to use gettext filter for changing the comment form.

| improve this answer | |
  • 1
    thanks. going on similar type previous answers i came up with add_filter( 'gettext', 'change_label'); function change_label($translated_text){ switch ( $translated_text ) { case 'Username' : $translated_text = __( 'Username or email', 'theme_text_domain' ); break; } return $translated_text; but no go. That being said I am just a copy and paster have no real coding knowledge – Valentine Cosgrave Aug 2 '12 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.