[wp-trac] [WordPress Trac] #41903: Unable to deactivate Heartbeat API

WordPress Trac noreply at wordpress.org
Sun Sep 17 13:16:05 UTC 2017


#41903: Unable to deactivate Heartbeat API
-----------------------------------------+-----------------------------
 Reporter:  markbowenpiano               |      Owner:
     Type:  defect (bug)                 |     Status:  new
 Priority:  normal                       |  Milestone:  Awaiting Review
Component:  General                      |    Version:  4.8.1
 Severity:  normal                       |   Keywords:
  Focuses:  administration, performance  |
-----------------------------------------+-----------------------------
 Hi,

 In a vanilla install of WordPress 4.8.1 I am unable to disable the
 Heartbeat API using the following code placed into the 2017 themes
 functions.php file :


 {{{
 add_action( 'init', 'stop_heartbeat', 1 );
 function stop_heartbeat() {
 wp_deregister_script('heartbeat');
 }
 }}}


 I also found this code online and tried it too :


 {{{
 add_action( 'init', function () {
         wp_deregister_script('heartbeat');
 }, 1 );
 }}}

 Neither of which turn off the Heartbeat API as far as I can tell. I am
 very very new to WordPress so might be wrong on this but if the Heartbeat
 API is what is responsible for letting a user know that another user is
 editing a post then it is indeed NOT being turned off with either of the
 code snippets above as I am still getting those messages in the admin
 panel.

 The reason I am trying to turn it off ''(even on a vanilla install)'' is
 that I have a live site on a SiteGround server which is having the admin-
 ajax.php file hit a massive amount of times and if it weren't for the
 caching on the site then we would be using over 3 times the amount of CPU
 seconds in a day so I need to find a way to turn it off as we don't need
 to be told when someone is already editing a post.

 Not sure exactly what else the Heartbeat API is used for though?

 I'm wondering if the examples online are therefore incorrect or whether
 indeed the Heartbeat API just can't be turned off easily?

 Thanks,

 Mark

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41903>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list