How To Disable Or Limit Heartbeat API

Heartbeat API (Application Programming Interface) is one of the great features in WordPress. It is introduced since WordPress v3.6 to allow your browser communicate with the web server through AJAX (Asynchronous JavaScript and XML).

In other words, this API allows you to achieve real-time frontend updates. For example, showing other authors that certain post is currently being edited by another user. This is very useful for a blog with many authors. Still, many great features come at a great cost. Please read further below. This article is part of best useful tips for your WordPress.

What Is Heartbeat API

Basically, Heartbeat API is a round timer that will run continuously on your website. When your page is load, Heartbeat will create an interval that runs every 15 - 60 seconds. Each time upon completion, Heartbeat gathers data and send it to the server via a jQuery event and wait for a response.

An admin-ajax handler on the server side will take the passed data. Next, it will prepare the response and returns the data in JSON (JavaScript Object Notation) format. After that, the client will receive this data and fires a final jQuery event which indicates the data has been received.

Although this is a dream come true for developers which can lead to more possibilities, yet it has a drawback. In many cases, it will increase your CPU usage, PHP execution and inevitably slow down your website. This is inefficient and wasting especially for any bloggers on the shared hosting plan with the limited resource.

How To Disable Heartbeat API

I would highly recommend you to completely disable Heartbeat API if you meet two or more of the following conditions:

  1. You are the only user of your website which means there are no other authors, editors, etc.
  2. There is no need for you to use any features made possible by this API.
  3. You are always on the verge of reaching the limit of CPU usage or PHP execution set by your hosting provider.

To disable Heartbeat completely, all you need to do is copy and paste the following snippet into your functions.php or site-custom plugin. You might want to read how to create site-custom plugin or advantages of saving scripts in the site-custom plugin compared to functions.php.

By applying the above snippet, you will stop Heartbeat during WordPress initial phase. And essentially prevent any additional CPU usage or PHP execution that may be generated by Heartbeat.

Disable Or Limit Heartbeat API With A Plugin

Besides above approach, you can also disable or limit Heartbeat API with a plugin. There's a WordPress plugin called Heartbeat Control which allows you to disable or limit Heartbeat API with ease. It comes with the minimal setting but allows you to set any rules.

For example, you can choose which location you would like to apply those rules. You can choose to allow, modify or disable Heartbeat completely at the dashboard, frontend or post editor. On top of that, you can also set a frequency to any rules you create. Please take a look at the image below.

How To Disable Or Limit Heartbeat API
Heartbeat Control plugin setting page.


WordPress Heartbeat is indeed a great feature. Yet depending on circumstances, it may not suit for everyone. In any event, between two of approaches above, which is your preferred method to disable or limit Heartbeat API?

  • If you think your friends would find this useful, please share it with them. It will allow us help more people.
  • To get more of our latest update, please subcribe to our newsletter.
  • You can also print this article for reference.
This article has been printed from

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.