How to Stop WordPress Heartbeat From Overloading Your Host

The WordPress Heartbeat API is a polling mechanism that sends an authenticated request from the browser to admin-ajax.php at a fixed interval, and it is the usual reason a small site with one or two logged in editors can pin a shared host's CPU. Every open admin tab runs its own loop, so the load scales with the number of tabs and windows, not with the number of visitors. Understanding the wordpress heartbeat api hosting interaction means understanding that this is a server side cost driven by your own staff, not by traffic.

What the Heartbeat API actually does

Heartbeat is a client side loop built on the WordPress AJAX endpoint. The browser posts to /wp-admin/admin-ajax.php with an action of heartbeat, and the server responds with a JSON payload. The request carries the standard WordPress cookies and nonce, so it is a full bootstrap of the WordPress stack: PHP starts, the database connection opens, plugins load, and the response is serialised. That is the expensive part. The payload itself is small, but the boot cost is paid on every tick.

The default interval is set in wp-includes/js/heartbeat.js and is a short number of seconds. The client also sends a _nonce field and a screen_id, and the server uses the screen id to decide which handlers should run. Plugins hook into heartbeat_received and heartbeat_send to add their own data, which is why a plugin heavy site pays more per tick than a bare install. Post locking, autosave, session expiry warnings and the plugin and theme update checks all ride on this loop.

You can watch the traffic directly. Open the admin in a browser, open developer tools, and filter the network panel for admin-ajax.php. Each entry is a POST with a form body containing action=heartbeat. On the server side, the same requests show up in the access log:

grep 'admin-ajax.php' /var/log/nginx/access.log | tail -n 5
# 203.0.113.10 - - [..] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 412
# 203.0.113.10 - - [..] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 398

If those lines appear every few seconds from a handful of addresses, Heartbeat is your load. If they appear only when someone clicks, it is not.

Why it saturates limited hosting

Shared and small VPS plans are usually limited by PHP worker count and by CPU time per request, not by bandwidth. A Heartbeat tick holds a PHP worker for the duration of a full WordPress bootstrap, which on a modest box with a cold object cache can be a meaningful slice of a second. Multiply that by several open tabs, several editors, and a short interval, and the worker pool fills. Once every worker is busy, ordinary page requests queue behind the ticks, and the site looks slow to visitors who never touched the admin.

The database is the second victim. Each tick runs queries, and on a host without a persistent object cache those queries hit MySQL directly. Autosave and post locking also write, so a busy editor session produces a steady write load. None of this is a bug. It is the cost of the feature working as designed, and it is why the fix is throttling rather than removal.

Throttling the wordpress heartbeat api on hosting

The supported lever is the heartbeat_settings filter, which changes the interval the client uses. Raising the interval reduces the request rate without disabling anything. Put this in a small site specific plugin or in wp-content/mu-plugins/heartbeat.php so it survives theme changes:

<?php
add_filter( 'heartbeat_settings', function ( $settings ) {
    $settings['interval'] = 60; // seconds between ticks
    return $settings;
} );

Sixty seconds is a common compromise. Autosave still fires, post locking still works, and the request rate drops sharply. The tradeoff is that the "someone else is editing this post" warning and the session expiry notice arrive later, which matters if two people edit the same post at once. If your editors do not collaborate on the same posts, a longer interval is fine. If they do, keep it moderate and test.

To stop Heartbeat on the front end only, where it has no business running, deregister the script. This is safe because the front end does not need the loop:

add_action( 'wp_enqueue_scripts', function () {
    if ( ! is_admin() ) {
        wp_deregister_script( 'heartbeat' );
    }
} );

Some sites go further and disable Heartbeat in the admin entirely with wp_deregister_script( 'heartbeat' ) on admin_enqueue_scripts. Do not do this casually. It breaks autosave, post locking and the session expiry warning, and some page builders and form plugins depend on the loop for their own live features. If you must disable it, do so per screen using the screen_id the client sends, so the post editor keeps working while list tables and dashboard screens do not poll.

Verify the change and look at the rest of the stack

After deploying, confirm the interval changed by watching the network panel again, or by checking the access log rate before and after. A quick count over a fixed window tells you whether the change took effect:

grep -c 'POST /wp-admin/admin-ajax.php' /var/log/nginx/access.log

Compare that count across the same window length before and after the change. If it did not move, a plugin is probably re-registering the script or overriding the filter, and you should check for a conflicting heartbeat_settings callback. Also confirm that your page cache is not caching admin-ajax.php, and that the admin itself is excluded from any full page cache, since a cached admin response would break nonces and logins.

Next, look beyond Heartbeat. If the box is still busy, check whether a persistent object cache is in place, whether the database is on the same host as PHP, and whether cron is running on every page load instead of on a real system cron. Those three items often matter more than the Heartbeat interval. Start by measuring, change one thing at a time, and keep the change in a plugin or mu-plugin so you can revert it without touching core.

Related articles

Subscribe to our newsletter

Get the latest hosting tips, performance insights, and industry news.