Terrilörsgatan 4, 74 231 Östhammar, Sweden

Limit or Disable WordPress Heartbeat API

Having problems with your WordPress website being slow or not responding? It might be caused by WordPress Heartbeat API. The Heartbeat API was introduced back in WordPress 3.6 and what it does is to keep track of revisions, sessions management and more.

Although it’s very small in size (only 98 bytes) it can cause a lot of problems for some, mostly performance is dropped or the server may even become non-responding.

Most people that contact their hosting provider when their WordPress website is slow may get the answer by them that the: POST /wp-admin/admin-ajax.php is the main cause. The admin-ajax.php script is part of the Heartbeat API.


How does the Heartbeat API work?

The Heartbeat API sends a server request every 15 seconds. The request checks so you still have a connection to the server and it also provides developer to trigger events. In case the request takes more than 30 seconds to process, WordPress will display an error and try to reconnect to the server.

So short and simple: WordPress runs an Ajax call from the web-browser to keep a track on what happens in the dashboard, is someone editing a post you can see that, and so on.

So if you are having a problem with performance, CPU or similar, you should consider disabling or limit the WordPress Heartbeat API.


How to limit Heatbeat API?

When you disable or limiting WordPress Heartbeat API you are also leaving out important features like auto-saving, session management, and revision tracking. However, this is sometimes required to keep your server at a lower usage.

There are two ways I would recommend to use to disable the WordPress Heartbeat API. Either by installing a plugin or by adding a code to the functions.php file of your theme.


Disable or Limit WordPress Heartbeat API with Plugin

First, we need to download and install the HeartBeat Control plugin. Login to your WordPress dashboard area and go to Plugins -> Add New. Enter “Heartbeat Control” in the search box.

Heartbeat API, Limit or Disable WordPress Heartbeat API

Find the plugin as in the image and hit “Install Now” and once installed hit “Activate Now”.

Heartbeat API, Limit or Disable WordPress Heartbeat API


Configure Heartbeat Control plugin to Limit or disable WordPress Heartbeat API.

To limit or disable the WordPress Heartbeat API with the plugin you just installed, go to settings -> Heartbeat Control.

Heartbeat API, Limit or Disable WordPress Heartbeat API

Here you will find two options, “Control Heartbeat Locations” and “Override Heartbeat Frequency”.

In the “Control Heartbeat Locations” you can select where you want Heartbeat API to be disabled. You can disable it everywhere, or only on the dashboard page as well as only be allowing it on post edit pages.

The “Override Heartbeat Frequency” allows us to set how often the WordPress Heartbeat API should run. The default is 15 seconds but you can and should pick a higher number.

Heartbeat API, Limit or Disable WordPress Heartbeat API

Once you made your choice, hit “Save Changes” and it’s done! You can now easily control the WordPress Heartbeat API with this single plugin, easy right?


Disable WordPress Heartbeat API with functions.php

If you rather completely disable the WordPress Heartbeat API without any plugin you can do so by editing the theme functions.php file.

Just copy and paste the following code into your functions.php file. This can be done by using the built-in editor in WordPress or manually with FTP.

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

In WordPress admin area, go to Appearance -> Editor and find functions.php in the list of files. Past the code and hit “Save Changes”. All done!

With FTP the file is located at:/wp-content/themes/theme-name/functions.php Just open it up with any text editor and paste the above code. Remember to save and upload the edited functions.php.


That’s all! You have now successfully limited or disabled the WordPress Heartbeat!

If you like this post, please share it. If you have any questions, please don’t mind contacting me or leave a comment below!

Related Posts

Leave a comment

You must be logged in to post a comment.