Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#47468 new defect (bug)

Cookie Expiry & Login Popup causes loss of any work currently busy with

Reported by: mitchellk's profile mitchellk Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2.1
Component: Users Keywords:
Focuses: Cc:


This is the most annoying thing in 5.x I will often start working on a post, do some extensive work and then very annoyingly at some point get a login popup due to the cookie having expired.

Results after this happens is being taken to a very nasty page saying "That link is no longer available" (< something like that) result: all work lost.

It's now happened to me a number of times and I do not recall having this on 4.x and prior versions.

If I actually start working inside Admin even 5 minutes before a cookie is due to expire, the system should be smart enough to detect I am actually an Admin and I am currently active and it should extend the cookie. Unless I can somehow bypass this annoying behavior myself?

Change History (5)

#1 follow-up: @SergeyBiryukov
5 years ago

  • Component changed from General to Users

#2 @mitchellk
5 years ago

Any update on this bug? A new version was released recently but this bug remains. It's a simple cookie setting isn't it?

#3 in reply to: ↑ 1 @mitchellk
5 years ago

Replying to SergeyBiryukov:

Is there any progress on this?

#4 @mitchellk
5 years ago

We have now had 2 new versions since this bug was reported and nothing has been done. Does nobody else find this an incredibly annoying bug ??? I would assume it's a mere few lines of code that needs to be changed somewhere where you set the expiry. Any idea if and when this will ever be fixed ??

#5 @mitchellk
5 years ago

Seems there is no intention of ever offering a simple setting for users.
Rather just hardcode things like this without having any switched or settings for users. Great approach. Might as well just close the issue.

For those wanting a fix, here's a simple PHP snippet to add to your functions.php of your theme.

add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_week' );
function keep_me_logged_in_for_1_year( $expirein ) {
    return 604800; // 1 week in seconds


add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_month' );
function keep_me_logged_in_for_1_year( $expirein ) {
    return 2628000; // 1 month in seconds
Note: See TracTickets for help on using tickets.