How To Disable Heartbeat API in WordPress

Automation is the market demand. WordPress started thinking about sophisticated automation between web browsers and web servers a long time ago.

With WordPress 3.6, HeartBeat API was introduced to communicate between a web browser and a 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 easy 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 a web browser and a web server. It uses AJAX calls to communicate.

If so many plugins are using heartbeat API, a huge number of AJAX calls will be made to the web server. 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, Heartbeat API comes with some exciting features that many end users may find very useful.

Below are a couple of features that heartbeat API offers.

  • Enables post-revision features in the WordPress dashboard
  • Autosave posts
  • 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 web server.

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 web server. 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.

The below image shows the snapshot from a C Panel.

Heartbeat 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 on Google 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.

The below image the improvement in speed after I stopped the heartbeat API.

How to Limit Heartbeat API in WordPress

Implications of using Heartbeat API

Heartbeat API not only slows down your website, but it can also 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. Hosting companies follow 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, Perfmatters is the best to disable or limit Heartbeat API.

Below are the steps that show how to do that.


Go To Perfmatters Plugin Setting

You need to log in to the WordPress dashboard-> Setting-> Perfmatter to access the Perfmatters setting.

limit heartbeat API

Go To General Tab

Under settings, go to the “General” tab.

limit heartbeat API

Access The Heartbeat Tab

Scroll down to the Heartbeat API option in the general tab.

limit heartbeat API

Under the ” Disable Heartbeat” option choose from the following option.

limit heartbeat API

If you choose the option “ Disable Everywhere” then you don’t have to set the frequency. If not, you can choose the frequency here.

limit heartbeat API

Ideally, you can keep the option ” Only Allow When Editing Posts/ Pages” checked unless you feel that your dashboard is super slow.

That will ensure that you still have access to features like Auto-Save, Post revisions, Live statistics, etc. If you don’t need those features, you can select ” Disable Everywhere“. That will disable the heartbeat API on the backend as well as the front end.

If you want to use WP Rocket to disable the heartbeat API, then you can refer to the following video.

Disable 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 code 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 editor 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.

FAQ | Limit Heartbeat API

What Is Heartbeat API In WordPress?

Heartbeat API is a communication protocol for WordPress to communicate between a web browser and a web server.

With Heartbeat API, WordPress developers do not need to write hundreds of lines of code to create a communication protocol between a web server and a web browser, instead, they can simply use the Heartbeat API

Heartbeat API uses AJAX calls to communicate.

How To Disable Heartbeat API?

You can disable the Heartbeat API by adding the following piece of code in the function.php file located in the child theme directory.

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


Rajib Is The Founder Of RiansTech. A Seasonal Blogger And A Full-Time Product Designer For Over Two Decades. A Technology Freak And Loves To Write About It. RiansTech Is A Online Home For Him Where He Documents His Experiences And Learnings So That Others Can Get Benefited From It.