Remember Me Checked By Default On Login Box

How to Remember Me Checked By Default On Login Box

in WordPress Admin
Google+ LinkedIn

By default the remember me checkbox on WordPress login page is always unchecked and you have to select it every time you visit login page of your website. To be honest, it’s really annoying and frustrating. Well, at least for me. Although, it’s a small thing, but it makes the login form more usable and faster to process.

And unless you are using a public computer, you would also prefer remember me checkbox to be selected by default so you don’t have to keep clicking it while logging in.

JavaScript to the rescue here. Here is a code snippet you can add to your functions.php file which will make sure that the checkbox is always checked when you go to the login page.

// remember me checked by default on login box
function wcs_remember_me_check() {
    echo "<script type='text/javascript'>document.getElementById('rememberme').checked = true;</script>";
}
function wcs_remember_me_checked() {
    add_filter( 'login_footer', 'wcs_remember_me_check' );
}
add_action( 'init', 'wcs_remember_me_checked' );

Share the love

If you like this snippet, share it with others!

Leave a Reply

Your email address will not be published. Required fields are marked *