Set the WordPress heartbeat interval for lower CPU use
WordPress heartbeat traffic is easy to misdiagnose because each request appears tiny in the browser’s Network panel. Yet a quiet dashboard left open can keep PHP workers active while the site is otherwise still. Knowing how to set up a WordPress heartbeat interval to reduce CPU usage is therefore a useful troubleshooting step, especially when hosting plans enforce strict processing limits.
The browser sends recurring administrative requests, and every request can load WordPress, activate plugins and query the database. A plugin that treats each heartbeat as a trigger for a large query can turn routine polling into a continuous load. Increasing the interval reduces the frequency of that work; it does not repair a callback that is expensive every time it runs.
A conservative setting is usually enough. Moving active admin polling from 15 seconds to 60 seconds can reduce heartbeat requests by about 75 percent when the timing is consistent. Larger values save more resources but can delay autosave, revision updates, post-lock signals and plugin notifications. The best interval depends on how often editors work, how many administrators are signed in and which features must remain responsive.
The methods below cover the core WordPress filter, screen-specific control and a browser-side fallback. They also show how to measure the result instead of guessing. Australian hosting conditions are considered because local CPU quotas, data-centre locations and support hours can make a modest efficiency gain especially valuable.
How WordPress heartbeat polling works
WordPress loads a small JavaScript file called heartbeat in relevant admin screens. While an authenticated user works, the browser sends a POST request to /wp-admin/admin-ajax.php with action=heartbeat. The default polling cycle is commonly about 15 seconds for an active session, although focus and screen behaviour can alter some requests. Anonymous visitors generally do not produce this stream of admin requests.
Each response can contain plugin data and browser state such as whether the window has focus. Core uses heartbeat signals around autosave and revision behaviour, while post locking and admin notifications can also rely on timely responses. Plugins subscribe to JavaScript and PHP heartbeat events, so the API effectively becomes a general-purpose scheduled communication channel inside wp-admin.
Heartbeat should not be confused with WP-Cron. WP-Cron runs scheduled PHP tasks through a WordPress request, often wp-cron.php, and handles unrelated jobs such as cleanup, scheduled publishing and WooCommerce actions. Changing the heartbeat interval will not move or reschedule those jobs. This distinction matters when a server’s CPU graph remains busy after the number of browser requests has fallen.
Why frequent polling consumes server resources
A heartbeat request passes through much of the same WordPress bootstrap as any other authenticated request. Depending on the server, PHP-FPM or Apache starts or reuses a worker, WordPress loads active plugins, and MySQL handles queries needed for authentication and site data. Even a response with no visible content can cost enough CPU to matter on a small shared plan.
Plugins are the usual source of disproportionate usage. A callback attached to heartbeat_received or heartbeat_send might scan orders, update option values, call a remote service, clean transients or query posts. Every editor can also create overlapping requests. Five signed-in administrators polling every 15 seconds produce up to roughly 20 heartbeat requests per minute, compared with about five per minute at a 60-second interval.
This pattern is common on sites hosted on small Australian shared plans. Australian regions in Sydney, Melbourne, Brisbane and Perth are common hosting choices, while many entry-level plans impose a CPU quota rather than unlimited processing. A Brisbane agency may have several client dashboards open on the same resource-constrained server, while a Sydney retailer may run WooCommerce on a VPS with only a couple of available vCPUs. Reducing polling helps, but moving an expensive plugin callback to a scheduled job is a better final remedy.
Choosing an interval that protects editing
Start with 60 seconds for a normal site where administrators need the dashboard occasionally and collaborative editing is rare. It materially lowers request volume while keeping most interface updates reasonably current. A busy editorial team can use 30 seconds on the post editor and 120 seconds on dashboard or index screens, but mixed intervals require a small amount of conditional code.
Avoid extreme values such as five minutes unless the site is effectively static and every plugin that listens for heartbeat events has been tested. A long gap can make autosave feel unreliable, allow a second editor to hold a stale lock longer and delay notices about background changes. It can also make a busy dashboard appear frozen, even when the database and web server are healthy.
Set a target from real usage. If one idle dashboard generates approximately 240 requests per hour, changing the interval from 15 to 60 seconds can remove about 180 requests during that hour. If several staff work simultaneously, include them in the estimate. A 75 percent reduction in heartbeat requests does not guarantee a 75 percent reduction in total site CPU because other traffic and background processes continue running.
Applying the interval in WordPress
The most maintainable method is a must-use plugin because WordPress loads it automatically and it survives theme changes. Create wp-content/mu-plugins/heartbeat-interval.php, place the following code in it, and adjust the interval for the site:
<?php
/**
* Reduce core heartbeat polling for authenticated users.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_filter(
'heartbeat_settings',
static function ( $settings ) {
$settings['interval'] = 60;
return $settings;
}
);
Because the filter returns the complete settings array, the change adds no custom heartbeat action and leaves the endpoint available for plugins. A child theme’s functions.php can hold the same filter, but a must-use plugin is safer when themes are replaced regularly. Test on staging first, then deploy through the agency’s normal release process. If the directory does not exist, create it; PHP files placed directly inside are loaded automatically.
For a larger reduction on high-traffic admin screens without slowing other areas as much, replace the previous filter with a scoped version:
add_filter(
'heartbeat_settings',
static function ( $settings ) {
$settings['interval'] = 60;
$screen = function_exists( 'get_current_screen' )
? get_current_screen()
: null;
if ( $screen && 'dashboard' === $screen->id ) {
$settings['interval'] = 120;
}
return $settings;
}
);
This version keeps most admin screens at 60 seconds while giving the main Dashboard a 120-second interval. Replace the screen identifier as needed, but test each one because a plugin may attach important work to a particular admin page. Avoid globally dequeuing the heartbeat script unless autosave, locking, notices and every installed plugin have been confirmed to work without it.
A JavaScript override is available when PHP control is unavailable. In an admin script loaded after WordPress’s heartbeat script, change the interval with this code:
jQuery( document ).on( 'heartbeat-tick', function ( event, data ) {
data.interval = 60;
} );
Use the PHP filter where possible. It centralises the policy in server code, survives theme changes and can be version controlled. The JavaScript approach needs correct admin enqueueing, may be reordered by other scripts and may leave the first poll on the original timing. Whichever route is chosen, retain the previous value so rollback takes seconds.
Testing the change and confirming the CPU reduction
Establish a baseline before editing anything. In browser developer tools, open the Network panel, preserve the log and filter for admin-ajax.php or the heartbeat action. Record the request count and spacing over ten minutes with a dashboard open, then repeat the same test after the change. Test both a focused tab and a backgrounded tab because WordPress and plugins may respond differently to focus state.
Compare the request count with server telemetry rather than relying on a momentary spike. Australian hosting dashboards often show hourly averages, while htop or top on a VPS reveals whether PHP-FPM or MySQL remains busy. Check CPU, available memory, database process lists and PHP error logs over matching periods. A content delivery network will not cache authenticated heartbeat POST requests, so cache hit rates do not explain this traffic.
If the request rate falls but CPU does not, investigate other schedulers. WooCommerce Action Scheduler, WP-Cron, image processing, security scans, XML-RPC requests and unfiltered bot traffic can all create a similar busy graph. Move WP-Cron to a controlled system cron where appropriate, and profile the heartbeat callbacks separately. If anonymous front-end traffic is causing the load, heartbeat is unlikely to be the main culprit. Also check whether another plugin applies a later heartbeat_settings filter or resets the interval in JavaScript.
Compare monitoring timestamps in Australian local time. Sydney and Melbourne shift between AEST and AEDT, Brisbane remains on AEST, and Perth uses AWST without daylight saving. A daylight-saving change can otherwise make two apparently identical CPU periods differ by an hour, leading to a false conclusion that the heartbeat adjustment failed.
Deployment checklist for Australian WordPress sites
Use a staged rollout and record the reason for each interval. The following checklist keeps the change measurable and reversible:
- Record a ten-minute baseline of heartbeat requests, CPU usage and MySQL activity before making any change.
- Begin with a 60-second interval, then use a longer dashboard-specific value only when editing features do not require faster updates.
- Deploy the filter through a must-use plugin or controlled child theme, keeping the previous configuration available for rollback.
- Verify request spacing in browser developer tools and test autosave, revisions, post locking, admin notices and plugin workflows.
- Monitor CPU and request volume over several representative working days, including evenings when Australian editors may publish scheduled content.
For Australian WooCommerce merchants, heartbeat should not be treated as a substitute for the systems that confirm payments, create orders, send email or fulfil shipping. Keep AUD and GST-inclusive pricing, shipping zones, Action Scheduler and transactional notifications working as intended, then limit the heartbeat adjustment to administrative polling. WooCommerce checkout and order processing may use other request paths, which is why a lower heartbeat count does not guarantee that every checkout-related process uses fewer resources.
For organisations covered by the Privacy Act 1988 and the Australian Privacy Principles, longer polling intervals do not change access, security or retention obligations. Continue using HTTPS, limiting administrator accounts and applying sensible retention to access logs and diagnostic payloads. A shorter interval can expose the same administrative data more often, while a longer one can leave stale activity on screen for longer, so access controls and log review remain essential.