Are you wondering how to keep WordPress from forgetting you and stay logged in to your website? We often hear from users who are tired of WordPress logging them out and want to stay signed in.
If you use WordPress on a daily basis, then getting logged out every so often can get annoying really quickly. The Remember Me functionality prevents this from happening, but its default duration may not be enough time for some people.
In this guide, we will show you how to keep WordPress from forgetting you by extending its native Remember Me feature.
What is the Remember Me Functionality in WordPress?
In WordPress, the Remember Me login feature lets users stay logged into the content management system (CMS) for around 2 weeks.
So, if a user closes WordPress and has this feature turned on, they will automatically be signed in the next time they open WordPress within those 2 weeks.
Here’s what the Remember Me checkbox looks like on the WordPress login page:
If WordPress users forget their login credentials, then they won’t need to worry about resetting their passwords, as they’ll be automatically signed in. Then, they can start working on their WordPress websites right away.
That said, 2 weeks may not be enough for people who frequently work on their websites, like bloggers or WooCommerce store owners. That’s why many users look for solutions to stay logged in for much longer.
In this article, we will show you different methods to prevent your WordPress website from forgetting your user login by enabling the ‘Always Remember Me’ functionality. You can use the links below to quickly skip to a specific method:
Method 1: Make WordPress Always Remember You With Custom Code (Recommended)
This custom code method is for people who want a straightforward way to stay logged in on WordPress and don’t need extra features for their WordPress login URL (/wp-login.php).
If you are new to adding code in WordPress, then the process may seem intimidating. Typically, you will need to open a code file like functions.php via the file manager of your WordPress hosting provider or an FTP client.
But this step-by-step guide will use the WPCode plugin instead, which makes the process much safer and easier.
Note: This guide will use the free version of WPCode. That said, if you are looking for more advanced features like a testing mode and conditional logic, then you can upgrade to the WPCode Pro version.
First, you will need to install and activate the WPCode plugin. If you need some pointers, go ahead and check out our guide on how to install a WordPress plugin.
After that, head to Code Snippets » Library from the WordPress admin dashboard.
From there, search for the ‘Extend Login Expiration Time’ snippet. Once you find the snippet, hover over it and click on the ‘Use snippet’ button.
On the next page, you’ll see that WPCode has automatically added the code.
This code will extend the Remember Me functionality to 30 days rather than 2 weeks.
It also has set the proper insertion method and added a title and tags to help you remember what the code is for.
Now, just toggle the ‘Active’ button at the top menu to make the code work right away. Then, click the ‘Update’ button.
And that’s all you need to do to extend the Remember Me feature for your WordPress user login screen.
If you’re an advanced user, you can copy and paste this code into your functions.php file instead of using WPCode. You can make the duration longer than 4 weeks, but make sure to set the time in seconds.
function wpbeginner_remember_me($expires) {
return 2419200; // Set the time in seconds (e.g., 2419200 for 4 weeks)
}
add_filter('auth_cookie_expiration', 'wpbeginner_remember_me');
You can also add the following code right below the code above to make the Remember Me checkbox ticked by default:
function wpbeginner_login_checkbox() {
?>
<script>
document.getElementById('rememberme').checked = true;
document.getElementById('user_login').focus();
</script>
<?php
}
add_filter('login_footer', 'wpbeginner_login_checkbox');
If you feel uncomfortable with adding code and want an even simpler process, then you can try this next method.
Method 2: Make WordPress Always Remember You With InstallActivateGo.com Remember Me
The second method uses the InstallActivateGo.com Remember Me plugin. It’s a good alternative to the first method if you want to both stay logged into WordPress and optimize your user login and authentication processes.
First, you will need to install and activate the plugin. For more information, check out our beginner’s guide on WordPress plugin installation.
Next, go to the InstallActivateGo Remember Me plugin settings page on your WordPress admin sidebar.
After that, make sure that the ‘Disable’ checkbox is unticked. Otherwise, the plugin cannot override the default WordPress login settings.
Below the checkbox, you will find some settings to customize the WordPress login form.
For the ‘Set Remember Me as Default?’ setting, you can choose whether the Remember Me functionality should apply to all user logins via the WordPress admin area, the site’s front-end login page (for example, if you have a membership website), or both.
Alternatively, you can select ‘No Default’ if you want WordPress to leave the login settings up to each user’s choice. For this, make sure the ‘Remember User Choice’ box is ticked below.
In the ‘…for how long?’ field, you can specify how many days a user can stay logged in.
Once everything looks good, you can scroll down and click ‘Save Changes.’
And that’s it! You won’t need to see the WordPress login form again when you open the WordPress admin area, as you’ll be signed in from the get-go.
What to Keep in Mind When Extending the WordPress Remember Me Feature
At WPBeginner, we understand how frustrating it is to be unexpectedly logged out of WordPress, especially when you are in the middle of something important. But there’s a good reason WordPress usually keeps you logged in for only 14 days.
It’s all about protecting your site from cyber criminals. These folks often try to break into your WordPress through password guessing or brute-force attacks.
If they manage to get hold of your computer or gain remote access, then they could easily hack into your WordPress site. In turn, they could cause real trouble for your website’s security. In other words, the 14-day limit is like an extra layer of defense against these potential risks.
In fact, some people remove the Remember Me functionality entirely for security reasons.
The good news is that you can still prolong the Remember Me feature without compromising your website security. Here are some tips:
- Enable password protection on your WordPress login screen. Then, users must enter an additional username and password before they even reach the login page.
- Limit the login attempts on your WordPress website. When hackers fail to access the admin page after a few times, WordPress will automatically lock them out.
- Add two-factor authentication to WordPress. This feature will require new users to use an additional code in their login screen after entering their login credentials. If they don’t have the right code, then they won’t be signed in.
For more information about WordPress site protection, you can check out our ultimate WordPress security guide.
We hope this article has helped you learn how to keep WordPress from forgetting you by extending the Remember Me feature. You may also want to bookmark our guides on how to moderate new user registrations and how to add a Google one-click login in WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Dennis Muthomi
The WPCode plugin method you shared is perfect – way better than messing with functions.php directly. Here’s what I’ve learned from doing this myself: I always set different login times for different users. It works great! Admins get 30 days, while editors stay at the regular 14 days. It’s a nice balance of security and convenience.
Coral Henderson
This plugin did not work for me. Anyone know why? I’m also having other issues with my site such as things changing by themselves. I don’t know if this is to do with the theme or wordpress or what..
Coral Henderson
Thanks for this. I always checked the remember me button but it was always unchecked when I went back to the site. I wonder if this is due to my site not being live yet? Dunno.
David chriss
Hello, WP Beginner…
Does this will fix my site because in my site if user click on remember me button. it doesn,t remember them even if they checked remember me.
Also i using user ultra word press plugin. Does this compatible with that plugin
Please reply…
Alex Colburn
Yes, this is a quick fix that saves a lot of time! Thank you.
Jayne Bodell
Again, you seem to know our pain points. This has really been bothering me lately. Thanks much.