2

I've read that Heartbeat can slow a WP site down and I'm assuming if our admins/store managers have a lot of admin windows/tabs open, this will exacerbate the issue.

If yes, is there a condition to test and log the calls that Heartbeat makes so I can see if the site slowdown could be related to an excess of Heartbeat calls?

I had a look in the documentation and elsewhere but only found ways to deregister the script ( wp_deregister_script('heartbeat'); ) - not what I need.

Or am I barking up the wrong tree and this is something that should be monitored via server logs, by watching: /wp-admin/admin-ajax.php ?

  • 1
    I remember playing with this some time ago here. – birgire Apr 30 '15 at 20:52
4

From quick look at the code, there is number of hooks firing in wp_ajax_heartbeat(). Out of which heartbeat_tick action seems quite appropriate to hook some logging logic too.

For the sake of completeness, while you are interested in logged in activity, the hook would be heartbeat_nopriv_tick for logged out users.

| improve this answer | |
  • Thanks @Rarst - the hook does the trick. I threw together a quick function to email me everytime there was a "tick" and ran it for an hour. Amusingly, I am the worst culprit! add_action ( 'heartbeat_tick', 'xcsn_heartbeat_tick' ); function xcsn_heartbeat_tick ($response, $screen_id) { //Send an email or whatever } – Pat Gilmour May 1 '15 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.