钩子文档

heartbeat_send

💡 云策文档标注

概述

heartbeat_send 是一个 WordPress 过滤器,用于修改 Heartbeat API 发送的响应数据。它允许开发者在响应发送前自定义内容。

关键要点

  • heartbeat_send 是一个过滤器,用于过滤 Heartbeat 响应。
  • 它接受两个参数:$response(响应数组)和 $screen_id(屏幕 ID)。
  • 在 wp_ajax_heartbeat() 函数中调用,处理 AJAX 请求。
  • 自 WordPress 3.6.0 版本引入。

代码示例

$response = apply_filters( 'heartbeat_send', $response, $screen_id );

📄 原文内容

Filters the Heartbeat response sent.

Parameters

$responsearray
The Heartbeat response.
$screen_idstring
The screen ID.

Source

$response = apply_filters( 'heartbeat_send', $response, $screen_id );

Changelog

Version Description
3.6.0 Introduced.