Created
August 7, 2013 01:44
-
-
Save WerdsWords/6170505 to your computer and use it in GitHub Desktop.
#35: heartbeat_received
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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