티스토리 뷰

wordpress/functions.php

로그인 세션 늘리기

보라소년 2015. 8. 13. 13:50

워드프레스의 로그인 시간을 늘려 작업을 편하게 해준다.

add_filter('auto_cookie_expiration', 'my_expiration_filter', 99, 3);
function my_expiration_filter($seconds, $user_id, $remember) {
    if( is_admin() ) {
        // if "remember me" is checked;
        if ( $remember ( {
            // WP defaults to 2weeks;
            $expiration = 140*24*60*60 // 140일
        } else {
            // WP defaults to 48 hrs/2 days;
            $expiration = 20*24*60*60 // 20일
        }
        // http://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;
    }
}


'wordpress > functions.php' 카테고리의 다른 글

관리자 글보기에 썸네일 이미지 노출하기  (0) 2016.08.22
단축코드 만들기 예  (0) 2015.08.13
add_images_size  (0) 2015.08.13
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31