I am tired from this problem (I don't know if it's specific to firefox or not).

As some time passes after I log in to my site (of course, I check "remember me". ), I have to log in to my site again. How to stop WP from asking me so frequent logins? Like Facebook does - you log in and that's all until you log out.

I've tried add_filter('auth_cookie_expiration' .... but it didn't help.

p.s. I use iThemes Security (if it matters).

  • 4
    Does it still happen after you check the Remember Me option (while you log in)?
    – Fayaz
    Commented Feb 7, 2017 at 14:49
  • Whitelist your wordpress site on your auto-delete cookie addons and it won't log out so fast anymore.
    – user147790
    Commented Jul 30, 2018 at 15:07

1 Answer 1


WordPress keeps you logged in for 48 hours by default.

If you click the "Remember Me" checkbox, it will remember you for 14 days.

If you would like to remain logged in for longer than this period of time, you must use the "Auth Cookie Expiration" hook that WordPress provides. Now, you've mentioned that you've used this without any effect. My geuss is that there is something incorrect in the application of this hook.

Here is an example use of the hook that has been tested and verified by multiple users:

function wpse108399_change_cookie_logout( $expiration, $user_id, $remember ) {
    if( $remember && user_can( $user_id, 'manage_options' ) ){
        $expiration = 60;// yes, I know this is 1 minute
    return $expiration;
add_filter( 'auth_cookie_expiration','wpse108399_change_cookie_logout', 10, 3 );

It comes from this WPSE post: Extending auth_cookie_expiration based on user role

Here is an article that goes into depth about extending the auth_cookie_expiration, specifically about how to extend it to a year's time: https://premium.wpmudev.org/blog/how-to-extend-the-auto-logout-period-in-wordpress/

One final idea would be to also hook to the auth_cookie_expired hook, which activates once your authorization cookie officially expires. You could add code to create a new cookie everytime the old cookie expires.

Beyond this, there is no documented way to accomplish what you're asking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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