#36: heartbeat_send

The heartbeat_send allows you to modify the Heartbeat response sent when no $_POST data is passed. It is the logged-in, privileged sibling of heartbeat_nopriv_send.

It was added in 3.6.

It is evaluated in wp_ajax_heartbeat() in the wp-admin/includes/ajax-actions.php file.

Like heartbeat_nopriv_send, heartbeat_send accepts 2 arguments:

  1. array|object $response The response object or array.
  2. string $screen_id The screen id.

Example:

There is no example for this filter yet. Have an idea for one? Submit an example.

#35: heartbeat_received

The heartbeat_received ilter allows you to modify the Heartbeat response data in logged-in AJAX situations. It is the logged-in version of heartbeat_nopriv_received.

It was added in 3.6.

It is evaluated in wp_ajax_heartbeat() in the wp-admin/includes/ajax-actions.php file.

Like heartbeat_nopriv_received, heartbeat_received accepts 3 arguments:

  1. array|object $response The nopriv Heartbeat response.
  2. array $data An array of data passed via $_POST.
  3. string $screen_id The screen id.

Example:

Since we already have a working example for heartbeat_nopriv_received, we’ll reuse that here.

The following example is based on a Heartbeat example Gist written by Jason Coleman and kindly suggested by jsternberg in the comments.

It modifies the $response value to return a ‘marco polo’ scenario showing the server “responding” to the AJAX call. Thanks to for the suggestion!

View the code example on Gist.

#34: $type_send_to_editor_url

The $type_send_to_editor_url filter allows you to modify the HTML markup sent to the editor when inserting non-image embed links into the editor.

The dynamic $type part of the filter hook accepts file, audio, or video.

Filtering image embed links sent to the editor is handled separately via the image_send_to_editor filter.

It is evaluated in:

$type_send_to_editor_url accepts 3 arguments:

  1. string $html The HTML link markup to send to the editor.
  2. string $url The media item source URL.
  3. string $title The media item title.

Example:

The following shows how you might add a data-type attribute (such as for JavaScript manipulation) to a video link when it is inserted into the editor.

View the code example on Gist.