1. Home
  2. Applications Management
  3. WordPress
  4. How to Disable or to Limit WordPress Heartbeat

How to Disable or to Limit WordPress Heartbeat

WordPress Heartbeat API is a simple server polling API built into WordPress, allowing near-real-time frontend updates.

 The API  is using the admin-ajax.php file to make AJAX calls. If you notice a significant amount of POST requests to that file, this means that you need to limit WordPress Heartbeat frequency or to completely disable it.

Sending excessive requests to admin-ajax.php can lead to high CPU usage.

How to disable WordPress Heartbeat

To completely disable it, go to the functions.php file of your WordPress theme and paste these lines right after the opening <?php tag:

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

This will completely disable this functionality and it will be no longer added to the total number of executions and CPU time used by your website.

How to limit  WordPress Heartbeat

In case you don’t want to disable it completely, you can simply limit its execution frequency. You can do this by using a plugin called Heartbeat Control.

Once you have installed the plugin you can decrease the Heartbeat frequency to 60 seconds or above. It is recommended to set Heartbeat locations to “Allow only on post edit pages”.

That’s a wrap!

You now know how to completely disable or to limit WordPress Heartbeat.

Don’t forget that ChemiCloud’s infrastructure supports WordPress out of the box. If you’d like to experience top speed and reliability and have access to amazing WordPress Experts, try our WordPress hosting.

Updated on July 24, 2019

Was this article helpful?

Related Articles

Need help?
We're always here for you. Submit a ticket or Chat with a live person.
Submit Ticket