secure_auth_cookie
云策文档标注
概述
secure_auth_cookie 是一个 WordPress 过滤器钩子,用于控制认证 cookie 是否仅通过 HTTPS 发送。它允许开发者基于用户 ID 动态调整安全设置。
关键要点
- secure_auth_cookie 是一个过滤器钩子,用于修改认证 cookie 的 HTTPS 发送行为。
- 它接受两个参数:$secure(布尔值,表示是否仅通过 HTTPS 发送)和 $user_id(整数,用户 ID)。
- 在 wp_set_auth_cookie() 函数中调用,用于设置用户认证 cookie。
- 自 WordPress 3.1.0 版本引入。
原文内容
Filters whether the auth cookie should only be sent over HTTPS.
Parameters
$securebool-
Whether the cookie should only be sent over HTTPS.
$user_idint-
User ID.
Source
$secure = apply_filters( 'secure_auth_cookie', $secure, $user_id );
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |