check_ajax_referer
云策文档标注
概述
check_ajax_referer 是一个 WordPress 钩子,在 Ajax 请求验证后触发,无论验证是否通过。它提供验证结果信息,用于安全处理 Ajax 请求。
关键要点
- 钩子名称:check_ajax_referer,在 Ajax 请求验证后触发
- 参数:$action(Ajax nonce 操作字符串)和 $result(验证结果,false 表示无效,1 表示有效且在 0-12 小时内生成,2 表示有效且在 12-24 小时内生成)
- 相关函数:check_ajax_referer() 用于验证 Ajax 请求以防止外部处理
- 版本历史:自 WordPress 2.1.0 引入
原文内容
Fires once the Ajax request has been validated or not.
Parameters
$actionstring-
The Ajax nonce action.
$resultfalse|int-
False if the nonce is invalid, 1 if the nonce is valid and generated between 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
Source
do_action( 'check_ajax_referer', $action, $result );
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |