1

enter image description here

I would like to replace "Username" in the Wordpress login form with another word. How do I go about doing that?

1

You can use the gettext filter:

/**
 * Rename the 'Username' label in wp-login.php
 *  
 * @see http://wordpress.stackexchange.com/a/159507/26350
 */

add_filter( 'wp_login_errors',
    function( $errors )
    {
        add_filter( 'gettext', 'wpse_change_username', 99, 3 );
        return $errors;
    }
);

function wpse_change_username( $translated_text, $untranslated_text, $domain )
{
    $old = "Username";
    $new = "Jediname";

    if ( $untranslated_text === $old )
        $translated_text = $new;

    remove_filter( current_filter(), __FUNCTION__ );

    return $translated_text;
}

where we hook into the wp_login_errors, which is very close to the username input.

Here's a screenshot:

Username->Jediname

| improve this answer | |

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.