The short answer: Heartbeat is a “pulse” that WordPress sends to the server every few seconds while the dashboard or the editor is open. It is used to save drafts, warn that someone else is editing the same page, and check whether your session has expired. With many tabs open, that is many requests to the server. The cure is to slow it down, not to switch it off.
Each pulse is a request to the admin-ajax.php file with the action heartbeat. The interval depends on the screen: shorter in the page editor, longer in the rest of the dashboard. By default it runs in the dashboard and in the editor, and not on the pages visitors see.
How to tell whether it is Heartbeat
| 2 |
If the site slows down or hits its limit while someone is editing, and calms down when that person closes the tabs, Heartbeat is a good suspect.
|
|
What to do
| Measure |
What changes |
| Close dashboard tabs nobody is using |
Every open tab, even one forgotten overnight, keeps sending pulses. It is the simplest measure and the one that fixes most. |
| Lengthen the interval between pulses |
WordPress accepts an interval set in code. You keep all the protection with fewer requests. |
| Switch it off completely |
It ends the requests, but you lose safe autosave, the warning about simultaneous editing and the expired-session notice. Only do this knowing what you lose. |
To lengthen the interval, add this code to the functions.php of a child theme, or to a code-snippets plugin (see A plugin or a snippet of code):
add_filter( 'heartbeat_settings', function ( $settings ) {
$settings['interval'] = 60;
return $settings;
} );
The number is in seconds. Measure before and after, as in What eats CPU on a website.
|
The site slows down when someone edits and you cannot tell why? Open a ticket with the address and the time it happened.
Open a support ticket
|
RECOMMENDED PRODUCT WordPress hosting One-click install, updates handled, and speed that holds up. from R118.80/mo (3-year plan, with coupon) See plans |