The WordPress Heartbeat API is a common point of discussion when it comes to speeding up a WordPress site. While it facilitates a number of key WordPress features, it can lead to significant CPU usage if left unchecked.
In this guide, we’ll take a look at what WordPress Heartbeat is, what it does, and how you can easily control its functionality to optimize your site’s performance.
What Is The WordPress Heartbeat API?
The WordPress Heartbeat API is a system that allows WordPress to send data between the server and the browser in real time. This rapid two-way communication enables features like auto-saving, revision tracking, session management, and postA post is a type of content in WordPress, a popular open-source content management system used for creating an... More locking (when one user tries to edit a post that another user is currently editing).
It’s called “Heartbeat” because it simulates a pulse, with data being exchanged every 15-60 seconds.
The Heartbeat API is also available to developers, who can use it to add similar functionality to themesA WordPress theme is a set of files that determine the design and layout of a website. It controls everything ... More and plugins.
If you’re interested in the technical details, WordPress.org explains:
When the page loads, the client-side heartbeat code sets up an interval (called the “tick”) to run every 15-60 seconds. When it runs, heartbeat gathers data to send via a jQuery event, then sends this to the server and waits for a response. On the server, an admin-ajax handler takes the passed data, prepares a response, filters the response, then returns the data in JSON format. The client receives this data and fires a final jQuery event to indicate the data has been received.
In simple terms, this means the browser and the server remain in contact for the duration of a user’s session, exchanging information at regular intervals.
What The WordPress Heartbeat API Does

Let’s take a look at what the WordPress Heartbeat API actually does, and what sort of functionality it brings to the table.
Autosaving & Revisions
One of the most valuable benefits of the Heartbeat API is the ability to automatically save drafts and revisions while you’re working—without ever having to click the “Save Draft” button.
The last thing you want is to lose your hard work because you accidentally closed your browser or clicked a link to another page. In earlier versions of WordPress, this was such a common occurrence that many people were hesitant to compose content in the WordPress editor, instead opting to write in a separate application and copy the finished product into WordPress later.
Thankfully, the Heartbeat API prevents that sort of disaster by regularly sending the latest version of your post from your browser to the server.
Post Locking
Another potentially disastrous scenario is when two users try to edit the same post simultaneously. There’s no way that ends well—someone’s work is bound to get lost.
However, the Heartbeat API checks in regularly to let WordPress know that a user is currently editing a post. When someone else attempts to edit that same post, they’ll be met with this warning:

This is an important safeguard made possible by Heartbeat.
Real-Time Notifications & Comment Updating
Developers can use the Heartbeat API to make use of the “pulse” in their own themes and plugins.
One such example would be real-time notifications, delivered without requiring the user to reload the page. There are also plugins that enable the comment section to update in real time.
These are just a couple of examples. There are countless other use cases for real-time client-server communication.
How WordPress Heartbeat Influences Performance
As we’ve seen, the Heartbeat API can be incredibly useful for adding real-time functionality to WordPress. However, these features come at a cost.
At every “pulse” of the WordPress Heartbeat, a POST
request is sent to /wp-admin/admin-ajax.php
.
This happens every 15 seconds on post edit pagesIn WordPress, a page is a content type that is used to create non-dynamic pages on a website. Pages are typica... More, and every 60 seconds on the main WordPress dashboardIn WordPress, the Dashboard is a central hub for managing a website's content and settings. It is the first sc... More.
Yes, these requests are sent every 15-60 seconds—even if you just log into WordPress and leave your browser open.
As you can imagine, this behavior can have a notable impact on your site’s performance, especially if you have multiple users.
If your web host is showing high CPU usage attributed to /wp-admin/admin-ajax.php
, the Heartbeat API is likely to blame.
How To Manage The WordPress Heartbeat API
If you find that the Heartbeat API is using excessive resources, you can speed up your website by either disabling it or managing the frequency of the pulse.
Is It Safe To Disable The Heartbeat API?
In most cases, it’s safe to disable Heartbeat if you’re the only person working on your site and you know you don’t have any important plugins or functionality that rely on it. With that said, it’s still a good idea to test this on a staging site first, if you can.
Keep in mind that if you completely disable Heartbeat, you will lose features like auto-saving, post locking, and any real-time functionality added by your plugins or theme. If you need these things, I recommend modifying the pulse frequency instead (see below).
How To Disable The Heartbeat API
To disable the Heartbeat API, simply add the following code to your theme’s functions.php
file:
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}
This will completely disable the Heartbeat API on your website. If you want to reenable it later, simply remove that code from your theme.
How To Limit The Heartbeat API
If you don’t want to disable Heartbeat completely, you can limit the pulse frequency by installing the Heartbeat Control pluginA plugin is a software component that adds specific features and functionality to your WordPress website. Esse... More.
Heartbeat Control is a highly rated free plugin from the developers of WP Rocket, which we found to be the best WordPress caching plugin.
Once you’ve installed Heartbeat Control, log into WordPress and go to Settings > Heartbeat Control Settings
.

On this page, you can add various rules that dictate how the WordPress Heartbeat is allowed to behave on your website.
For each rule, you can choose to Allow Heartbeat, Disable Heartbeat, or Modify Heartbeat. The rule will apply only to the locations you select—e.g. the WordPress Dashboard, Frontend, or Post Editor.

If you choose to modify Heartbeat, a slider will appear where you can specify your desired pulse frequency in seconds. You can set it to anything from 15 to 300.
If you want to set different limits for different parts of your site, you can simply create multiple rules.
Final Thoughts
The WordPress Heartbeat API enables a lot of great features by providing real-time communication between the browser and the server. Auto-saving and post locking, for example, solve some of the most frustrating problems from earlier versions of WordPress.
These features do come at a cost, though. The more time you spend in your WordPress dashboard, the more CPU requests will pile up, leading to higher resource usage, slower performance, and in more serious cases, hosting account suspensions.
Luckily, it’s quite simple to mitigate those issues by managing the behavior of the WordPress Heartbeat API.
If you have any questions about WordPress Heartbeat, please feel free to leave them in the commentsComments are a feature of WordPress that allow users to engage in discussions about the content of a website. ... More below!