🎉 Use coupon MYXERO to enjoy 20% recurring discount on any plan. View Pricing

Fine-Tuning the WordPress Heartbeat API for Lower CPU Usage

XeroWP May 2, 2026 6 min read
Fine-Tuning the WordPress Heartbeat API for Lower CPU Usage

The Silent CPU Killer in Your WordPress Dashboard

Imagine you are working on a high-traffic WordPress site. You have several tabs open: the post editor for a new announcement, the WooCommerce orders screen to track sales, and the main dashboard to monitor site health. Suddenly, your hosting provider sends an alert: your server CPU usage is spiking at 90%, causing the front end of your site to crawl for actual visitors. You check your traffic logs, but there is no surge in visitors. So, what is happening?

The culprit is often a built-in feature called the WordPress Heartbeat API. While it provides essential functionality, it can act like a silent drain on your server resources if left unconfigured. At XeroWP, we prioritize performance, and understanding how to manage this API is one of the most effective ways to maintain a snappy admin experience without sacrificing server stability.

Understanding the WordPress Heartbeat API

Introduced in WordPress 3.6, the Heartbeat API provides a protocol for real-time communication between the browser and the server. It uses AJAX (Asynchronous JavaScript and XML) to send requests to the server and receive updates without requiring a page refresh.

Technically, it works by utilizing the admin-ajax.php file. Every 15 to 60 seconds, your browser sends a "pulse" to the server. The server then processes this request and sends back a response. This allows WordPress to perform several critical tasks:

  1. Autosaving: Periodically saving your drafts so you don't lose work if your browser crashes.
  2. Post Locking: Notifying you if another editor is currently working on a post so you don't overwrite their changes.
  3. Real-time Notifications: Showing plugin updates or e-commerce sales notifications in the dashboard.

While these features are helpful, they come at a cost. Every single pulse requires a full execution of the WordPress core, loading your active plugins and theme to process the AJAX request. If you have multiple administrators logged in simultaneously, those pulses multiply, leading to a massive spike in CPU load.

Why the Heartbeat API Can Slow Down Your Site

The problem isn't the API itself, but the frequency and context of its execution. On a standard shared hosting environment or an unoptimized VPS, the resource overhead of spawning a PHP process every 15 seconds per user can be devastating.

Consider this math: If you have five tabs open and the heartbeat is set to a 15-second interval, your browser is hitting admin-ajax.php 20 times per minute. If you have a team of three editors doing the same, that is 60 requests per minute. On many servers, this constant background noise prevents the CPU from entering an idle state, leading to thermal throttling or process queuing that delays the loading of your actual website for your customers.

How to Identify Heartbeat Bloat

Before you start disabling features, you should verify if the Heartbeat API is actually causing your performance issues. You can do this easily using your browser's Developer Tools:

  1. Open your WordPress Dashboard.
  2. Right-click and select Inspect, then go to the Network tab.
  3. Filter the results by searching for admin-ajax.php.
  4. Watch the list for a few minutes. You will see new entries appearing periodically.
  5. Click on an entry and look at the 'Payload' or 'Post Data'. If you see action: heartbeat, you have found the source.

If these requests are taking a long time to resolve (e.g., over 500ms) or are happening too frequently for your needs, it is time to optimize.

Method 1: Using the Heartbeat Control Plugin

For most users, the most efficient way to manage this is through the Heartbeat Control plugin by WP Rocket. It provides a simple graphical interface to limit or disable the API in different areas of your site.

Step-by-Step Configuration:

  1. Install and activate the Heartbeat Control plugin from the WordPress repository.
  2. Navigate to Settings > Heartbeat Control.
  3. You will see three locations: WordPress Dashboard, Frontend, and Post Editor.

For the Frontend, it is generally safe to select 'Disable Heartbeat' unless you use a plugin that specifically requires it (like a live-bid auction plugin). For the Dashboard, we recommend 'Modify Heartbeat' and increasing the frequency to 60 seconds. For the Post Editor, you should keep it enabled to ensure autosaves work, but increasing the interval to 60 seconds is a good compromise.

Method 2: Manual Optimization via Code

If you prefer to keep your site lean and avoid adding another plugin, you can control the Heartbeat API using PHP snippets in your theme's functions.php file or a functional plugin.

Disabling Heartbeat Everywhere (Not Recommended)

If you want to kill the API entirely (warning: this disables autosave and post locking), use this snippet:

add_action('init', 'xerowp_stop_heartbeat', 1);
function xerowp_stop_heartbeat() {
    wp_deregister_script('heartbeat');
}

Slowing Down the Pulse Rate

A better approach is to slow down the frequency of the pulse. The following code increases the interval to 60 seconds (the maximum allowed by the API):

add_filter('heartbeat_settings', 'xerowp_slow_heartbeat');
function xerowp_slow_heartbeat($settings) {
    $settings['interval'] = 60;
    return $settings;
}

Disabling Heartbeat on the Frontend Only

There is rarely a reason for the Heartbeat API to run on the public-facing side of your site. You can disable it specifically for the frontend with this logic:

add_action('init', 'xerowp_disable_frontend_heartbeat', 1);
function xerowp_disable_frontend_heartbeat() {
    if (!is_admin()) {
        wp_deregister_script('heartbeat');
    }
}

Balancing Functionality and Performance

When optimizing, the goal is not always to disable, but to balance. If you are a solo blogger, you can safely set the Post Editor heartbeat to 60 seconds. However, if you run a large newsroom where multiple authors might open the same post at once, keeping a faster pulse in the Post Editor is vital to prevent 'collision' where two people edit the same paragraph simultaneously.

At XeroWP, we see many users struggle with admin-ajax.php usage. While Heartbeat is a major factor, it is also worth checking if your plugins are making excessive AJAX calls for other reasons, such as shopping cart fragments or analytics tracking. Combining Heartbeat optimization with a high-performance managed host ensures that your server has the overhead to handle these pulses when they are actually necessary.

Conclusion: A Faster Admin for a Faster Site

Optimizing the WordPress Heartbeat API is a low-hanging fruit that can result in immediate CPU relief. By reducing the frequency of these background requests, you free up your server to focus on what matters: delivering content to your visitors as fast as possible.

Whether you choose the simplicity of a plugin or the precision of a code snippet, taking control of your site's 'pulse' is a hallmark of a well-managed WordPress installation. If you are tired of monitoring CPU graphs and want a platform that handles the heavy lifting of performance optimization for you, discover how XeroWP can transform your hosting experience today.