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.

If you enjoyed this tutorial, then you’ll love our support. All ChemiCloud’s hosting plans include 24/7 support from our amazing support team.

Check out our Managed WordPress hosting plans and have your website migrated today!

Updated on October 16, 2024
Was this article helpful?

Related Articles

Spring into Savings!
Up to 78% Off Hosting Plans + Free Migration!
👉 View Deals

Leave a Comment