• Resolved alshizawi

    (@alshizawi)


    Hello ,

    I am facing a problem every time when i log in , after some time like few minutes of activities on editing viewing or visiting page , suddenly it asks to login again !

    I clear the cache on my browser , i installed a cache plugin to clear the cache on the site , but still i am facing the problem ,

    what could it be from and how to solve it ?

Viewing 2 replies - 1 through 2 (of 2 total)
    • Try deactivate all plugin to troubleshooting
    • Try use another web browser.

    If you still have problem log in, make sure your hosting server is on good condition.

    Thread Starter alshizawi

    (@alshizawi)

    I fix it by adding this snippet for Session Expiration Time :

    /** Session Expiration Time - Login Time */
    
    add_filter('auth_cookie_expiration', 'my_expiration_filter', 99, 3);
    function my_expiration_filter($seconds, $user_id, $remember){
    
        //if "remember me" is checked;
        if ( $remember ) {
            //WP defaults to 2 weeks;
            $expiration = 14*24*60*60; //UPDATE HERE;
        } else {
            //WP defaults to 48 hrs/2 days;
            $expiration = 2*24*60*60; //UPDATE HERE;
        }
    
        //https://en.wikipedia.org/wiki/Year_2038_problem
        if ( PHP_INT_MAX - time() < $expiration ) {
            //Fix to a little bit earlier!
            $expiration =  PHP_INT_MAX - time() - 5;
        }
    
        return $expiration;
    }
    
    • This reply was modified 1 year, 7 months ago by alshizawi.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Login Timeout !’ is closed to new replies.