WordPress keep logged in after browser close

You can use the following 2 filter hooks


add_filter('auth_cookie_expiration', 'auth_cookie_expiration_filter_5587');
function auth_cookie_expiration_filter_5587()
{
    return YEAR_IN_SECONDS * 5;
}

and:

add_filter('auth_cookie_expiration', function () {
    return YEAR_IN_SECONDS * 5;
});