Turn off the Heartbeat API on the public site
Stops WordPress’s Heartbeat requests on the public site, where nothing needs them. The editor keeps its autosave and post locks.
<?php
add_action(
'init',
static function () {
if ( ! is_admin() ) {
wp_deregister_script( 'heartbeat' );
}
},
1
);
Good to know
Plugins that use Heartbeat on the front end (some live chat or booking plugins) stop updating in real time.
In these packs
- More speed: More ways to load less: block styles, speculative loading, fewer scripts.