워드프레스에서 로그인 시간을 조정하고 싶다면 이것을 가능하게 해주는 플러그인이 있다. 쿠키유지시간 – https://wordpress.org/plugins/wp-login-timeout-settings/ -> Setting -> Login timeout 에서 설정 * 참고 위의 플러그인이 설치되어 있는 경우 functions.php 에서 아무리 add_filter로 아래처럼해도 먹히지 않는다;; 이 플러그인 설치되어 있는줄 모르고 삽질함..
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 |
$login_data = array(); $login_data['user_login'] = $username; $login_data['user_password'] = $wp_pass; $login_data['remember'] = $remember; $user_verify = wp_signon($login_data, true); //Changes the current user by ID or name. //wp_set_current_user( $user_verify->ID, $user_verify->user_login ); wp_set_current_user($user_verify->ID); //var_dump($user_verify); exit; function wpc_expire_login_cookie() { return 31536000; // one year in seconds: 60 * 60 * 24 * 365 } add_filter( 'auth_cookie_expiration', 'wpc_expire_login_cookie' ); $remember = "1"; wp_set_auth_cookie($user_verify->ID, $remember); |