How to Limit Heartbeat API in WordPress

Did you notice that your website is loading very slow although you have a clean coded theme and few plugins, Did everything possible but still no luck? Scratching your head on what could be the reason?

Automation is market demand nowadays. Off late WordPress started thinking about sophisticated automation between web browsers and web servers.

With WordPress 3.6, HeartBeat API was introduced to communicate between a web browser and web server in a better way.

Heartbeat API brought a much-needed opportunity for plugin developers to quickly connect to a web server using the API.

It made their life much easier as they no longer need to write thousands of lines of code to connect to web servers. Instead, they have to use heartbeat API to connect.

Though heartbeat API brought many useful features, it may also slow down your website. This is due to the excessive API calls that the heartbeat API makes to a web server.

Slow-loading websites lead to poor user experience and a high bounce rate. Limiting the heartbeat API is a must if you want to speed up your website. So in this article, we will talk about How to limit Heartbeat API in WordPress.

What Is Heartbeat API

As the name suggests, Heartbeat API is a communication protocol between the web browser and web server. It uses AJAX calls to communicate.

If so many plugins use heartbeat API, a huge number of AJAX calls will be made to the webserver. This in turn slows down the website loading speed.

You might be wondering, when this heartbeat API has so many issues, then why do we really need it? Well, this API comes with some exciting features that many end users may find very helpful. Below are a couple of features that heartbeat API offers.

  • Enables post revision features in the WordPress dashboard.
  • AutoSaves drafted posts every 15 seconds.
  • Lock post-editing for a multi-authored blog.
  • Show all notifications in the WordPress dashboard
  • Shows real-time sales data for Woo Commerce stores

How Heartbeat API works

Heartbeat API uses the admin-ajax.php file located under “/wp-admin/admin-ajax.php“ to send AJAX calls for communicating with the webserver.

At times when many plugins use the heartbeat API, it stops responding and you will be presented with a CPU overutilization error.

The heartbeat API trigger pulses every 15 seconds to make sure there is a connection between the web server and web browser.

Each pulse executes one PHP script and thus makes one CPU call to the webserver. If the pulse takes more than 30 seconds to get a response, WordPress throws a connection error.

How to monitor Heartbeat API

There is no option in the WordPress dashboard to check the uses of Heartbeat API. You can ask your web host to send a report of CPU utilization statistics. You can also use the statistics data from your C-Panel dashboard.

If you use Siteground or any other managed WordPress hosting, you may be having their statistic tools which you can refer to check Heartbeat API uses. The below option shows how you can access this data in your SiteGround dashboard.

SiteGround Dashboard -> Select Website -> Site Tools -> Statistics -> Traffic -> Behavior

How to Limit Heartbeat API in WordPress

If you refer to the above image, you can notice that the Admin-Ajax.php file is at the top of the most visited page. What that means is that the blog is using heartbeat API.

You can also check the GTMetrix waterfall chart to diagnose if your blog is using heartbeat API or not. The details of the same are explained in the next paragraph.

How to diagnose plugins using Heatbeat API

GTMetrix waterfall chart is the simplest way to check which plugins or files might be using heartbeat API.

Sometimes you may not see any plugin name and you may only see some codes. Searching with those codes may help you to figure out which plugin is using the API and fix it accordingly.

How to Limit Heartbeat API in WordPress

In the above waterfall chart, you may have noticed that ta_link_fixer is using the heartbeat API. A quick googling discovered that this is caused by an option in the plugin ” Thirsty Affiliates“.

When I unchecked the option and run the GTMetrix analysis, the heartbeat API issue disappears. I also noticed that once the heartbeat API is stopped, my website is loading much faster than before. You can notice the difference in fully loaded time.

How to Limit Heartbeat API in WordPress

Severe implications of using Heartbeat API

Heartbeat API not only slows down your website, but it can have more severe implications if you are using shared hosting. Typically all shared hosting allows a finite number of CPU utilization although they tell that they offer unlimited bandwidth.

Once you are hovering near to maximum CPU utilization of your account, the web host will send a warning email.

If you don’t take measures to reduce CPU utilization, they may even suspend your hosting account temporarily.

A repeated temporary suspension will lead to a permanent suspension without any refunds. The hosting company follows this practice to make sure every account gets equal resources in a shared host environment.

How to Disable WordPress Heartbeat API

The best way to limit heartbeat API in WordPress is to delete all those plugins which are using Heartbeat API.

Sometimes it is not possible as you will be losing a lot of functionalities. In this case, you may choose to limit the frequency of API calls. You can limit API calls using the following methods.

  • Using a plugin
  • Adding a few lines of code in the function.php file

Disable WordPress Heartbeat API using a plugin

It is advisable to use a plugin to limit the heartbeat API in WordPress. If you are not tech-savvy, using a plugin can save you from unnecessary issues.

Among all those plugins, Heartbeat Control is the best as it is developed by the same team who developed WP Rocket. Below is a quick overview of the plugin.

How to Limit Heartbeat API in WordPress

Once the plugin is installed you can head over to Settings -> Heartbeat Control to have the settings page of the plugin. You will be presented with heartbeat API controls in different scenarios as mentioned below.

  • WordPress Dashboard
  • Front end
  • Post-Editor

Ideally, you can keep the Heartbeat API running in the WordPress dashboard unless you feel that your dashboard is super slow.

On the front end, the heartbeat API should be disabled at all times as it affects the user experiences. In the case of Post Editor, it is preferable to disable the heartbeat API unless you want to have features like Auto-Save, Post revisions, Live statistics, etc.

On the settings page, you can also modify the pulse increment time instead of disabling it. For each scenario, it has a modify option where you can modify the pulse timings.

By default, it is 15 seconds and you can change it to anything you want. The modified pulse timing is really useful as it helps you speed up your blog but at the same time, you can enjoy the heartbeat features.

Control WordPress Heartbeat API without a plugin

If you don’t like to install a plugin for controlling the heartbeat API, you can use the following codes to stop the API from making any calls.

If you are using a child theme, you can add these lines of codes in the funtion.php file available in the child theme folder.

It is always advisable to take a backup of the file before making any changes so that if in case something goes wrong, you can retrieve that.

add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {

Conclusion: How to limit WordPress HeartBeat API

If you are a solo blogger and no other authors are accessing your WordPress dashboard, then it is high time to disable the heartbeat API.

That will save your bandwidth and the website will be much faster. You can even disable the heartbeat API in the post editor.

I know by doing so you will miss the auto-save and post revision features. But you can always write your article in Google Docs and paste the same into your WordPress post when it’s done.

You may know that every second’s delay costs you about 40% of the visitor. Do you want to lose those visitors just because of Heartbeat API?

I believe now you know How to disable heartbeat API in WordPress. So go ahead and disable heartbeat API and enjoy a faster loading website.

That’s all I have in this article. Do you see any other issues which are affecting your website speed? If yes, please do write in the comment section and I will try to offer a solution free of charge.

Before you leave this page, you may like to have a glimpse of recommended articles that may help you to do blogging in a better way.



Rajib is the Co-Founder and the Lead Product Analyst of RiansTech. A BTech in Mechanical Engineering and a veteran in the Home Appliance industry with over 17 years of experience in designing appliances for industry leaders like GE and Whirlpool. He also runs a successful niche blog (RiansClub) on Mechanical Engineering