简体   繁体   中英

How to change Idle time on the Wordpress admin dashboard?

I have a fresh installation of Wordpress 5.9, I installed the WPVivid plugin to restore from backup. However, the restoration process seems to take more than 15 mins but wordpress keeps logging me out with a popup message that says "session expired". How do I change that?, or maybe increase the idle timeout?

在此处输入图像描述

you can use this code it

add_filter('auth_cookie_expiration', 'ak_function', 99, 3);
function ak_function($seconds, $user_id, $sesstiontime){
    
    if ( $sesstiontime) {       
        $expiration = 14*24*60*60;
    } else {
          $expiration = 2*24*60*60; //UPDATE HERE;
    }
    if ( PHP_INT_MAX - time() < $expiration ) {
        $expiration =  PHP_INT_MAX - time() - 5;
    }

    return $expiration;
}

or

add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' );
function keep_me_logged_in_for_1_year( $expirein ) {
    return YEAR_IN_SECONDS; // 1 year in seconds
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM