WordPress: How to change the text labels on login and lost password pages

WordPress Admin Login Screen

Editing the text labels on the WordPress login form and the lost password form is pretty easy. There’s a handy action called gettext that all WordPress translated text for the entire site goes through (whether it’s being translated or not) that can be hooked into allowing you to change anything you like. Using this we can change any text we like almost anywhere on the site.

Change Username to Email

As a quick example, below is how you’d use the gettext action to replace Username with Email in the form labels. We’re wrapping it in the login_head action to ensure that it is only replaceed on the login page, otherwise it would do it site wide which we probably don’t want.

 * Changes 'Username' to 'Email Address' on wp-admin login form
 * and the forgotten password form
 * @return null
function oz_login_head() {
	function oz_username_label( $translated_text, $text, $domain ) {
		if ( 'Username or E-mail:' === $text || 'Username' === $text ) {
			$translated_text = __( 'Email' , 'oz-theme' );
		return $translated_text;
	add_filter( 'gettext', 'oz_username_label', 20, 3 );
add_action( 'login_head', 'oz_login_head' );

Yes, you can also use it to replace the callout text on the lost password page. Questions? comments? Criticism? Post ’em below.

2 thoughts on “WordPress: How to change the text labels on login and lost password pages”

Comments are closed.