heartbeat_tick
云策文档标注
概述
heartbeat_tick 是一个 WordPress 动作钩子,在登录环境中 Heartbeat API 每次心跳时触发,主要用于替换传输机制为长轮询。
关键要点
- 触发时机:在登录环境中,Heartbeat API 每次心跳时触发。
- 主要用途:允许轻松替换传输机制为长轮询。
- 参数:$response(数组类型,Heartbeat 响应)和 $screen_id(字符串类型,屏幕 ID)。
- 相关函数:由 wp_ajax_heartbeat() 使用,该函数位于 wp-admin/includes/ajax-actions.php 中,用于通过 AJAX 处理 Heartbeat API。
- 版本历史:自 WordPress 3.6.0 版本引入。
原文内容
Fires when Heartbeat ticks in logged-in environments.
Description
Allows the transport to be easily replaced with long-polling.
Parameters
$responsearray-
The Heartbeat response.
$screen_idstring-
The screen ID.
Source
do_action( 'heartbeat_tick', $response, $screen_id );
Changelog
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |