Answers for "change cookie expire time wordpress"

PHP
0

change cookie expire time wordpress

add_filter('auth_cookie_expiration', 'expiration_filter', 99, 3);
function 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 in seconds;
    } else {
        //WP defaults to 48 hrs/2 days;
        $expiration = 2*24*60*60; //UPDATE HERE in seconds;
    }

    return $expiration;
}
Posted by: Guest on October-21-2020

Browse Popular Code Answers by Language