问题
On the default WordPress login page, how do you change the label, "Username", to something else?
回答1:
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' );
回答2:
Simple Solution
add_filter( 'gettext', 'register_text' );
function register_text( $translating ) {
$translated = str_ireplace( 'Username or Email Address', 'Your Custom Text', $translating );
return $translated;
}
来源:https://stackoverflow.com/questions/12825865/change-wordpresss-login-label-username