Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Keep WordPress From Forgetting You With Remember Me

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Are you wondering how to keep WordPress from forgetting you and stay logged in to your website?

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.

How to Keep WordPress From Forgetting You With Always Remember Me

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:

The WordPress login page

If WordPress users forget their login credentials, then they won’t need to worry about resetting them, 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 website, like a blogger or online store owner. 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 WordPress 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:

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.

If you are new to adding code in WordPress, don’t worry. This guide will use the WPCode plugin, which makes the process safe and easy.

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 » + Add Snippet from the WordPress admin dashboard. Then, hover over ‘Add Your Custom Code (New Snippet)’ and click on ‘Use snippet.’

Use snippet

Now, let’s name the snippet. In our example, we will use ‘Remember Me Snippet.’

Next, in the Code Type dropdown menu, select ‘PHP Snippet.’

Inside the Code Preview box, you need to copy and paste the following lines of code:

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');

This code will extend the Remember Me functionality to 4 weeks rather than 2 weeks. You can make it longer, but make sure to set the time in seconds.

Here’s what your screen should look like:

Adding an always remember me snippet to the WPCode plugin

If you want, 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');

Once you’ve copied and pasted the code, scroll down to the Insertion section.

Make sure that the ‘Auto Insert’ method and ‘Run Everywhere’ options are selected. This way, the PHP code will be applied globally across your entire website.

Applying the code snippet everywhere using WPCode

After this, just toggle the ‘Active’ button at the top menu to make the code work right away. Then, click ‘Save Snippet.’

And that’s all you need to do to extend the Remember Me feature for your WordPress user login screen. 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 Using 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 dashboard.

After that, make sure that the ‘Disable’ checkbox is unticked. Otherwise, the plugin cannot override the default WordPress login settings.

Unchecking the Disable box in the InstallActivateGo Remember Me plugin

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.

Configuring the InstallActivateGo Remember Me plugin settings

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.

Clicking Save Changes on InstallActivateGo Remember Me plugin

What to Keep in Mind When Enabling WordPress Remember Me

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.

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 an unauthorized user fails 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 be interested in how to remove the Remember Me option 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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

6 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Coral Henderson says

    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..

  3. Coral Henderson says

    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.

  4. David chriss says

    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…

  5. Jayne Bodell says

    Again, you seem to know our pain points. This has really been bothering me lately. Thanks much.

Leave a Reply to Coral Henderson Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.