heartbeat_tick
Action HookDescription
Fires when Heartbeat ticks in logged-in environments. Allows the transport to be easily replaced with long-polling.Hook Information
File Location |
wp-admin/includes/ajax-actions.php
View on GitHub
|
Hook Type | Action |
Line Number | 3526 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$response
|
The Heartbeat response. |
string
|
$screen_id
|
The screen ID. |
Usage Examples
Basic Usage
<?php
// Hook into heartbeat_tick
add_action('heartbeat_tick', 'my_custom_function', 10, 2);
function my_custom_function($response, $screen_id) {
// Your custom code here
}
Source Code Context
wp-admin/includes/ajax-actions.php:3526
- How this hook is used in WordPress core
<?php
3521 * @since 3.6.0
3522 *
3523 * @param array $response The Heartbeat response.
3524 * @param string $screen_id The screen ID.
3525 */
3526 do_action( 'heartbeat_tick', $response, $screen_id );
3527
3528 // Send the current time according to the server.
3529 $response['server_time'] = time();
3530
3531 wp_send_json( $response );
PHP Documentation
<?php
/**
* Fires when Heartbeat ticks in logged-in environments.
*
* Allows the transport to be easily replaced with long-polling.
*
* @since 3.6.0
*
* @param array $response The Heartbeat response.
* @param string $screen_id The screen ID.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-admin/includes/ajax-actions.php
Related Hooks
Related hooks will be displayed here in future updates.