The WordPress Heartbeat API for the most part, should be disabled.
At the cost of server resources, the Heartbeat API uses /wp-admin/admin-ajax.php to run AJAX calls from the browser. In turn, it is able to show you real-time plugin notifications, when other users are editing a post (which sends a request every 15 seconds), and other features.
In my humble opinion, the Heartbeat API is just not worth the sacrifice in speed.
Many plugins let you disable the Heartbeat API (Heartbeat Control, WP Rocket, Perfmatters, LiteSpeed Cache) or you can disable it by pasting a small line of code in your function.php file.
What Does The WordPress Heartbeat API Do?
- Shows real-time plugin notifications
- Shows when other users are editing a post
- Shows when users are locked out for being idle
- Creates periodic auto saves, drafts, and revisions
- Shows real-time sales data when using eCommerce plugins
Important: always make sure to save your drafts when editing! If you disable the Heartbeat API and have auto drafts and post revisions turned off, you could risk losing all your hard work.
1. Install The Heartbeat Control Plugin
The easiest way to disable the WordPress Heartbeat API is with the Heartbeat Control plugin. Once installed, go to the General Settings and you can disable Heartbeat in the WordPress dashboard, frontend, and the post editor. Ideally, it is recommend you disable it everywhere.
If you don’t want to disable Heartbeat and limit it instead, you can modify Heartbeat and choose your own intervals. By default, the WordPress heart beats once every 15 seconds.
2. Manually Disable The WordPress Heartbeat API
, 1 );
[…] This article was written by Tom Dupuis and originally published on Tom Dupuis.
This article was written by Tom Dupuis and originally published on Tom Dupuis.