• 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

Viewing 1 replies (of 1 total)
  • Thread Starter markbowenpiano

    (@markbowenpiano)

    Does anybody possibly have any ideas on this at all?

    I did post this in the WordPress trac ticket system as a bug to only be told that it’s not a bug as the person there could get it to work.

    So whilst it might not be classed as a bug it is 100% definitely buggy!

    I’ve now tried on 7 different hosting platforms all with different versions of PHP, MySQL and everything I can think of and not one of them am I able to disable the Heartbeat or even limit it!

    I even got 3 other WordPress users to try and they couldn’t on their installs either.

    I seriously can’t believe for one minute that myself and 3 other people on now over 12 different server types can be doing something that wrong!

    There is definitely something afoot here and it seems like no-one wants to talk about it or address it.

    Please if anyone has any information on this at all, even if just to say yes it works for me and this is how I did it then please please please do speak up as I’d really appreciate hearing from you on this.

    Thanks,

    Mark

Viewing 1 replies (of 1 total)
  • The topic ‘Heartbeat API will NOT turn off’ is closed to new replies.