How to “remember me” on the WordPress login page

If you’re like me:

  1. You’re the only one who logs into your WordPress website.
  2. You only do it on your computer at home.
  3. You lock your computer every time you step away, even when there’s nobody at home.
  4. You have a 2FA plugin which adds a new field, and means checking your phone on each login.

You might have become annoyed from time to time when you forget to check the “Remember me” checkbox on the login page. You know that you will have to log in again tomorrow or whenever the login session expires, rather than in 2 weeks time. Just because of an empty checkbox.

There’s very valid reasons for not checking this box. If you use a public computer, or one in an office and don’t lock your computer, then you want to be logged out. For the rest of us, it’s a bonus if you don’t need to login again so soon.

Here’s a tiny little script that will check the “remember me” checkbox. Create a php script called remember-me.php in wp-content/mu-plugin/ with the following:

<?php
function remember_me_on_login() {
    $_POST['rememberme'] = 1;
}
add_action( 'login_init', 'remember_me_on_login' );

Then logout and visit wp-login.php and “remember me” will be checked for you!

If you want more control, there’s the Remember Me plugin, but it does the basic job in a similar way.

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close