I want to know how to change the login label such as Username or Email Address to Username within the wp-login.php?

3 Answers 3


All of these strings/labels are passed through translation functions, so you can use gettext filter to modify them.

function change_labels( $translated_text, $text, $domain ) {
    if ( 'Username' === $text ) {
        $translated_text = 'Username new label';
    return $translated_text;

function register_change_label_filter() {
    add_filter( 'gettext', 'change_labels', 20, 3 );
add_action( 'login_head', 'register_change_labels_filter' );
// this way our filter will work only on wp-login and not everywhere on site...

@William : although your solution may work, it's not the proper way (which is why you got a downvote).

What you really want to do is customize the login page. Start here: https://codex.wordpress.org/Customizing_the_Login_Form

On that page, you'll find this suggested code:

if ( ! is_user_logged_in() ) { // Display WordPress login form:
    $args = array(
        'redirect' => admin_url(), 
        'form_id' => 'loginform-custom',
        'label_username' => __( 'Username custom text' ),
        'label_password' => __( 'Password custom text' ),
        'label_remember' => __( 'Remember Me custom text' ),
        'label_log_in' => __( 'Log In custom text' ),
        'remember' => true
    wp_login_form( $args );
} else { // If logged in:
    wp_loginout( home_url() ); // Display "Log Out" link.
    echo " | ";
    wp_register('', ''); // Display "Site Admin" link.

Better to do it the right way, rather than some DOM kludge. IMHO.


As mentioned in the link, you can use the above code to set the $args you want to use. Just use the filter:

This login form has the filters: login_form_top, login_form_middle, and login_form_bottom. Each can print text in the form, as shown in the image on the right.

See the link for details on that, and the image referenced.

**Added **

If you look at the wp_login_form() function, you will see the source code referenced here: https://core.trac.wordpress.org/browser/tags/4.9.7/src/wp-includes/general-template.php#L0 .

At line 419, you will see this line:

$args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) );

which tells you that you can change the login form $args by using the

add_filter('login_form_defaults', 'your_login_form_fields_function');

So there is a filter that can be used to change the login form values (see this code for the $args parameters, shown in the wp_login_form function (see above source code reference, starting at line 390).

Which answers the question: how to change the login form fields/descriptions, by using the appropriate filter. And also shows that if you dig into the code a bit, you can find filters that might help you with a question.

  • 1
    This will work for a custom form, but not the login form on wp-login.php, which the question references. Jul 15, 2018 at 3:52
  • There was an implied filter in there, which would allow you to change the args. Probably should have mentioned the filter, but that info is on the page; right next to the area that has the code I referenced. But I'll add to my answer. Jul 15, 2018 at 21:58
  • As far as I can tell none of those filters are applied on wp-login.php, as that form is not based on wp_login_form(). Jul 16, 2018 at 5:51
  • @JacobPeattie : see the 2nd 'added' to my answer. The initial answer referenced building your own form, but linked to Codex about customizing the login form. And if you (or anyone) were to dig a bit deeper into that reference, you'd find that the wp_login_form function is used in templates to display a login form. And then you would find that there is a filter you can use. Which was the point of my answer: point a person in the right direction, with some hints from the Codex, and they will find their solution. And learn something in their effort. I stand by my answer, regardless of downvotes. Jul 16, 2018 at 17:23

Another way to change the text for any wordpress text is to do a 'translation'. WP by default is in en-US, you could add (for example) en_AU (Ausatraian English). Any translations not provided, will use the default language. You could use any translation plugin or editor to create 'translations' just for the text's that you want to change. Basically give your website an 'accent' ;)

  • 1
    Isn't it easier to use gettext filter? I don't think that changing language of site just to change this labels is a good idea... Jul 15, 2018 at 16:24
  • Well rather than hardcoding the new text in a plugin, use the translation files. Not really changing the language (still english ;) ), just saying instead of this text, send out that text. It might even be possible using a en-US language tag if people don't want to use other english tags
    – anmari
    Jul 16, 2018 at 1:30
  • You don't need to hardcode it - you can still (and you should) use this new text with translations. There is a reason why languages have locale (why it's not EN, but en_us, en_gb, and so on) and you shouldn't use them for changing labels. It's a nasty hack/work-around and not a solution. Jul 16, 2018 at 11:41
  • In this case hacking the login is quicker, but I disagree that translations are a 'hack'. To change some text to present say a dialected/accented version of the words used (ie the language) for a niche audience imho this a cleaner way to go. Adding a plugin even with it's own terms to be translated seems rather circular and more work. Imagine one wants to call users 'mates', maybe say 'G'day' not 'welcome' etc, the cleanest way to change consistently through the install is by 'translating' to a version of language (a dialect) Otherwise one is left hacking sections to change the text.
    – anmari
    Jul 17, 2018 at 3:11
  • Imagine this situation... You inherit some site. It’s in English. You notice that some labels are changed. How do you check how are the changed? (Remember, that you don’t need *.po files for translations to work, and *.mo files are binary, so you can’t use grep to find any string in them). You’re right - it’s quicker this way, but it’s a dirty hack - you won’t be able do document it, and if you forget why and how it was done it’s almost impossible to debug it... As a developer to developer - please, never use translations this way... Jul 17, 2018 at 5:27

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.