Heartbeat API will NOT turn off
-
Hi there,
I’m hoping this is something easy to fix although from my tests (very new to WordPress so please go easy with me if these tests are not very good!) doesn’t appear to be.
I have a site hosted on SiteGround which was eating through the CPU seconds like nobody’s business.
I’ve now managed to put it down to the Heartbeat API calling the admin-ajax.php file so much.
Small question about admin-ajax.php if I may? Am I correct in my thinking that this file is only ever fired if someone is actually logged into the control panel and not under any other circumstances such as someone just visiting the site?
To that end I found some code on the internet which is shown below :
add_action( 'init', 'stop_heartbeat', 1 ); function stop_heartbeat() { wp_deregister_script('heartbeat'); }
I read that this goes into the functions.php file of my theme at the very top after the opening <? tag.
I’ve placed it there however I’m fairly certain that the Heartbeat API is still running despite this.
Am I correct in my thinking that the Heartbeat API is what is responsible for when one user is editing a post and another user tries to edit it and they get a message warning them someone else is already editing that post?
If so then I am still getting those messages even with this code in place and with two completely different users on 2 completely different browsers.
I’m testing this on a localhost machine as don’t want to mess with the live site currently however this is a completely vanilla install of WordPress 4.8.1 with absolutely no plugins or custom themes being used. Just the standard 2017 theme.
So my questions would be :
1 – Is it even possible to turn off the Heartbeat API or is it a known issue that it actually can’t be turned off?
and
2 – If it definitely can be turned off then what am I doing wrong?Thanks for any help with this.
Best wishes,
Mark
- The topic ‘Heartbeat API will NOT turn off’ is closed to new replies.