My question is how to force the users that are auto-logged in because they previously checked "remember me" to log in again?

It may be something with cookies, but is there anything I can change/modify to do this ?

Thank you.


Generally, using jQuery cookie plugin, the code that checks for a cookie in user's system looks like this.

    $.cookie('name-of-cookie', 'true', { expires: 2});

Is there any similar in Wordpress to handle this?


2 Answers 2


You can reset the security keys, forcing all cookies to expire and all users to log back in. Edit wp-config.php and change even one character in any of the security strings.

There's a plugin that allows you to set the expiry time on your user's cookies. I haven't personally used it, so proceed with caution: Cookie Timout

Sending the user back to /wp-login.php?reauth=true removes the cookie and logs the user out, even if he was previously logged in with a cookie.

Finally, if you're developing a plugin or theme, you can call wp_clear_auth_cookie(); and the currently-logged-in user's cookie will be cleared. This will not necessarily log the user out, but it will remove the cookie for the next time the user visits the site.

  • Thank you. Which one of those keys? Anyone ? define('AUTH_KEY', ''); define('SECURE_AUTH_KEY', ''); define('LOGGED_IN_KEY', ''); define('NONCE_KEY', '');
    – EnexoOnoma
    Oct 28, 2011 at 20:22
  • Any one, but the one that makes most sense in this case would be LOGGED_IN_KEY
    – Tom Auger
    Oct 30, 2011 at 2:58

If you don't mind using a plugin this one will fix you up: http://wordpress.org/extend/plugins/inactivity-auto-sign-out-plugin/

  • Thank you for this. I am looking something more like my updated question. However I will try it if nothing found but I think is not what I want.
    – EnexoOnoma
    Oct 28, 2011 at 20:04
  • Your updated question is how the suggested pugin handles the issue. There's always at least two ways to do something the wrong way and the right way. All plugin=-s mentioned so far limit the cookie expiration time which will do what you are needing. My suggestion doesn't offer a fancy interface and to make changes to the amount of time logged in you need to actually crack open the code. I just thought I'd give the plugin author some credit instead of copy/pasting his code. Whichever route you choose I'm sure it will work, good luck. Oct 28, 2011 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.