Automatically check the Remember Me checkbox on login page

If you have kept the default settings for your WordPress login pages, then your “Remember Me” checkbox will stay unchecked unless you click on it. If you do check the box, this option will remember your login username and password and store them in a cookie which will be valid for two weeks. After that, you will be asked to enter your username and password again.

If you are working in a safe environment where you can always keep your username and password in your browser, you might want to make everything automatic.

In this article, we will show you a short function which will do just that – it will check the “Remember Me” checkbox for you every time you open the login page.

Check the Remember Me checkbox automatically:

  1. Open functions.php file
  2. Copy and paste the following code:
  3. function login_checked_remember_me() {
    add_filter( 'login_footer', 'rememberme_checked' );
    add_action( 'init', 'login_checked_remember_me' );
    function rememberme_checked() {
    echo "<script>document.getElementById('rememberme').checked = true;</script>";
  4. Save changes.

And that’s it. Now you can log out. If everything’s working correctly, you should see your checkbox already checked.

Of course, be careful with this code if you are going to use your login information on public computers – you don’t want your username and password stored on a public computer for 2 weeks, right?

If you want to completely remove this option so nobody can remember their login info, see how to remove “Remember Me” option from your WP login page.

Want to control “Remember me” options by plugin instead? Check out what Remember Me Controls can do for your site.

Start Blog Book


This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

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