wp_set_auth_cookie ( $user_id, $remember = false, $secure = '', $token = '' )

  • (int) user_id User ID.
  • (bool) remember Whether to remember the user.
  • (bool|string) secure Whether the auth cookie should only be sent over HTTPS. Default is an empty string which means the value of `is_ssl()` will be used.
  • (string) token Optional. User's session token to use for this cookie.
Defined at:
Change Log:
  • 4: .


Sets the authentication cookies based on user ID.The $remember parameter increases the time that the cookie will be kept. The default the cookie is kept without remembering is two days. When $remember is set, the cookies will be kept for 14 days or two weeks.

Related Functions

wp_parse_auth_cookie, wp_clear_auth_cookie, wp_generate_auth_cookie, wp_setcookie, wp_validate_auth_cookie

Top Google Results

User discussions

wpseek mobile