auth_cookie_expiration
apply_filters( ‘auth_cookie_expiration’, int $length , int $user_id , bool $remember )
筛选挂钩:筛选身份验证cookie过期期间的持续时间。
Filter Hook: Filters the duration of the authentication cookie expiration period.
参数(Parameters)
参数 | 类型 | 说明 |
---|---|---|
$length | (int) | 有效期的持续时间(秒)。 |
$user_id | (int) | 用户ID。 |
$remember | (bool) | 是否记住用户登录。默认为false。 |
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.8.0 | wp-includes/pluggable.php:841 | 2 | 0 |
笔记(Notes)
如何将WordPress会话中的时间延长一年的示例,只需将此代码输入`函数.php`或者插件。已添加其他持续时间以显示可以设置的不同时间。
示例的扩展,仅当$remember和low privelege时才延长过期时间。
auth_cookie_expiration 为WP2原创文章,链接:https://www.wp2.cn/hook/auth_cookie_expiration/