钩子文档

auth_cookie_expired

💡 云策文档标注

概述

auth_cookie_expired 是一个 WordPress 钩子,在认证 cookie 过期时触发。它提供 cookie 组件的参数,用于处理过期事件。

关键要点

  • 触发时机:当认证 cookie 过期时自动触发。
  • 参数:$cookie_elements 数组,包含 username、expiration、token、hmac、scheme 等组件,但不应假设其有效性,因为它们直接来自客户端提供的 cookie 值。
  • 相关函数:与 wp_validate_auth_cookie() 函数关联,用于验证认证 cookie。
  • 版本历史:自 WordPress 2.7.0 版本引入。

📄 原文内容

Fires once an authentication cookie has expired.

Parameters

$cookie_elementsstring[]
Authentication cookie components. None of the components should be assumed to be valid as they come directly from a client-provided cookie value.

  • username string
    User’s username.
  • expiration string
    The time the cookie expires as a UNIX timestamp.
  • token string
    User’s session token used.
  • hmac string
    The security hash for the cookie.
  • scheme string
    The cookie scheme to use.

Source

do_action( 'auth_cookie_expired', $cookie_elements );

Changelog

Version Description
2.7.0 Introduced.