Skip to content

Instantly share code, notes, and snippets.

@WerdsWords
Created August 7, 2013 01:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WerdsWords/6170505 to your computer and use it in GitHub Desktop.
Save WerdsWords/6170505 to your computer and use it in GitHub Desktop.
#35: heartbeat_received
<?php
/**
* Example 'Marco, Polo' Heartbeat data received filter.
*
* Based on an original Gist by Jason Coleman (https://gist.github.com/strangerstudios/5888123)
*
* @see wp_ajax_heartbeat()
*
* @param array|object $response The response object.
* @param array $data An array of $_POST data.
* @param string $screen_id The screen id.
*
* @return mixed The filtered response.
*/
function wpdocs_heartbeat_received( $response, $data, $screen_id ) {
if ( $data['client'] == 'marco' )
$response['server'] = 'polo';
return $response;
}
add_filter( 'heartbeat_received', 'wpdocs_heartbeat_received', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment