• I see a lot about creating a custom login page but can I just change the text label for the password field and the default login form?

    I want to add some custom text next to the word “Password” on the login form.

    <label for="user_pass">
    Password
    <br>
    <input id="user_pass" class="input" type="password" size="20" value="" name="pwd">
    </label>

    thanks!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The labels on the login form seem to be hardcoded, but something along these lines might work:

    function prefix_change_login_form_user_pass_label( $translated_text, $text, $domain ) {
    	global $pagenow;
    	if ( in_array( $pagenow, array( 'wp-login.php', 'wp_register.php' ) ) ) {
    		if ( 'Password' == $text ) {
    			$translated_text = 'Zoinks!';
    		}
    	}
    	return $translated_text;
    }
    
    add_filter( 'gettext', 'prefix_change_login_form_user_pass_label', 20, 3 );
    Thread Starter virtualgeorge

    (@virtualgeorge)

    I should of posted my solution here already but I did get something from wpmudev that worked. Pretty close to what you have. Thanks Barry, I noticed you responded on the plugin page as well! You wouldn’t think this would really be necessary but some users have a lot of issues with passwords for reasons I don’t understand LOL.

    function change_password_label() {
        add_filter( 'gettext', 'password_change', 20, 3 );
        function password_change( $translated_text, $text, $domain )
        {
            if ($text === 'Password')
            {
                $translated_text = 'Custom Password Label';
            }
            return $translated_text;
        }
    }
    add_action( 'login_head', 'change_password_label' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change label for "user_pass" on login form?’ is closed to new replies.