Add custom text next to "Password" on wp-login.php login form

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

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

Is that possible?
thanks!!

  • Tyler Postle

    Hey George,

    Hope you're doing well today!

    You can use this function here:

    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' );

    Just swap Custom Password Label with your preferred text. Start it with "Password" if you want to keep that in the label :slight_smile:

    You can add that code to your theme's functions.php or an mu-plugin. I've actually attached an mu-plugin file to make it easy for ya. Just download and unzip it, then edit the "Custom Password Label" text and upload that to:

    /wp-content/mu-plugins/

    If the mu-plugins folder doesn't exist you can create it.

    Hope that helps George!

    Cheers,
    Tyler

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.