wp_set_auth_cookie


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

Parameters:
  • (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: .

Description

Sets the authentication cookies for a given user ID.The `$remember` parameter controls cookie persistence: - If true, the cookie is persistent (default 14 days, filterable via {@see 'auth_cookie_expiration'}). - If false, the cookie is a browser session cookie (expires when the browser closes). Internally, {@see 'auth_cookie_expiration'} is still applied, to expire the login after two days or when the browser is closed, whichever occurs first.

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