Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to be able to change the text on the Log In button in wp-login.php - however, it's a bit more complicated than that. I want to be able to change it in the theme, rather than editing the core file directly, so that a) It doesn’t get overwritten when WordPress updates, and b) It'll transfer over if I distribute my theme at all.

I don't know if that's possible. All I can find on the internet is how to change the CSS of the login page, not the actual HTML/PHP.

share|improve this question
add comment

5 Answers

Just replace "login" button with an image in logins.css

share|improve this answer
add comment

By default, this is styled in the core of WP in the login.css and colors-fresh.css

You could always copy this into you theme's CSS

input.button-primary, button.button-primary, a.button-primary {
border-color: #298CBA;
font-weight: bold;
color: white;
background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
text-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0;
}

And make the changes you'd like to see and simply add the !important to the ones that are different. Like

input.button-primary, button.button-primary, a.button-primary {
border-color: #000 !important;
font-weight: normal !important;
color: orange !important;
text-shadow: none !important;
}

As far as changing the 'text' of the button, that's part of the WP core file and would be over written each time you updated and would not be transferred from site to site.

There's a couple of plugins that might help with customizing your login page a little more.

BM Custom Login
Custom Login

share|improve this answer
add comment

Modify the input 'value' with jQuery:

<script>
    $("#wp-submit").function(){
        $(this).attr('value', 'new_value');
    });
</script>

Include the script in the login_head:

function change_login_button() {
    echo '<script src="link_to_script.js"></script>';
}
add_action('login_head', 'change_login_button');
share|improve this answer
4  
The login page does not load jQuery by default, so you will have to enqueue that too - or do the replacement without jQuery. –  Jan Fabry May 29 '11 at 19:14
add comment

The "Log In" string is passed to the translation function, and you can filter that. To prevent needing to filter every little string, you can activate this filter right before the login form is printed.

add_action( 'login_form', 'wpse17709_login_form' );
function wpse17709_login_form()
{
    add_filter( 'gettext', 'wpse17709_gettext', 10, 2 );
}

function wpse17709_gettext( $translation, $text )
{
    if ( 'Log In' == $text ) {
        return 'WPSE 17709 Logging In!';
    }
    return $translation;
}
share|improve this answer
add comment

To supplement what has already been said by Jan Fabry, follows the same function with all terms of the login panel:

add_filter( 'gettext', 'wpse17709_gettext', 10, 2 );
function wpse17709_gettext( $custom_translation, $login_texts ) {

    // Login Main Page
    if ( 'Username' == $login_texts ) { return ''; } // Username Label
    if ( 'Password' == $login_texts ) { return ''; } // Password Label
    if ( 'Remember Me' == $login_texts ) { return ''; } // Remember Checkbox
    if ( 'Log In' == $login_texts ) { return ''; } // Login Button
    if ( 'Lost your password?' == $login_texts ) { return ''; } // Lost Password Link
    if ( '&larr; Back to %s' == $login_texts ) { return ''; } // Back to website

    // Login New Password
    if ( 'Please enter your username or email address. You will receive a link to create a new password via email.' == $login_texts ) { return ''; } // Message after logo
    if ( 'Username or E-mail:' == $login_texts ) { return ''; } // Label of username input
    if ( 'Log in' == $login_texts ) { return ''; } // Log In Link Text
    if ( 'Get New Password' == $login_texts ) { return ''; } // Button

    // Messages
    if ( 'You are now logged out.' == $login_texts ) { return ''; } // Log out message
    if ( 'User registration is currently not allowed.' == $login_texts ) { return ''; } // User registration disabled
    if ( 'Check your e-mail for the confirmation link.' == $login_texts ) { return ''; } // Check link confirmation on email
    if ( 'Check your e-mail for your new password.' == $login_texts ) { return ''; } // Check new password on email
    if ( 'Registration complete. Please check your e-mail.' == $login_texts ) { return ''; } // Registration complete
    if ( 'Your session has expired. Please log-in again.' == $login_texts ) { return ''; } // Expired Session
    if ( '<strong>You have successfully updated WordPress!</strong> Please log back in to experience the awesomeness.' == $login_texts ) { return ''; } // Sucessfully Wordpress Updated

    return $translation;

}
share|improve this answer
    
Note this comment by Samuel Wood (Otto) twitter.com/pippinsplugins/status/235558089028419587. Not only has WordPress some mixed feelings about this solution (weight). It also actually does what you tell it to do. It filters all core strings. You might be better of wrapping the relevant strings into a statement. If not 'Username' in example will be altered in at least 6 other locations. Locations probably not relevant to this solution. –  Cor van Noorloos Feb 28 '13 at 10:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.