How to stay logged in to your WordPress account forever

To keep track of who you are, WordPress uses cookies to store important information needed for it to work. Once you are logged into your WordPress account, information is stored to that little file which lets the system know the exact time when you got there and so it can identify you later on.

For security reasons this cookie won’t let you stay logged in forever. Let’s say you logged in to your account on a public computer and forgot to log out. If WordPress wouldn’t use this security method, anyone on that computer would be able to access your WordPress admin panel. That’s the reason you might like the limited time of your session.

But if you work from home or your office and there is no need for this security option, automatic logouts might grind your gears. To stay logged in “forever”, follow these few steps to tell your cookie how long to stay active.

  1. Open functions.php file in Appearance – > Editor menu
  2. Paste the following code:
  3. add_filter( 'auth_cookie_expiration', 'wploop_never_log_out' );
    	
    	function wploop_never_log_out( $expirein ) {
    	    return 1421150815; // 40+ years shown in seconds
    	}
  4. Update your file

And that’s pretty much it. You may change the number of seconds in the code but it really doesn’t make any change if it’s 20 or 40 years, does it. After you have done previous steps, WordPress won’t automatically log you out; you will stay logged in your WP account forever… or until you delete your browser cookies, of course.

START YOUR OWN BLOG

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 *