Search code examples
wordpresswordpress-theming

Change WordPress's login label, "Username"


On the default WordPress login page, how do you change the label, "Username", to something else?


Solution

  • I think this is a better alternative to the previous answer.

    function login_function() {
        add_filter( 'gettext', 'username_change', 20, 3 );
        function username_change( $translated_text, $text, $domain ) 
        {
            if ($text === 'Username') 
            {
                $translated_text = 'customLoginName';
            }
            return $translated_text;
        }
    }
    add_action( 'login_head', 'login_function' );