How To Disable The WordPress Heartbeat API (The Easy Way)

Home » WordPress Speed Tips & Tricks » How To Disable The WordPress Heartbeat API (The Easy Way)

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.

Disable Heartbeat

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

To disable the WordPress Heartbeat API without a plugin, go to Appearance > Theme Editor, then edit the functions.php file of your theme. Next, paste the code right after the <?php tag:

Disable WordPress Heartbeat Manually

add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}

 

3. Disable Heartbeat With WP Rocket

If you’re already using WP Rocket, they also have an option to disable or limit Heartbeat. One major advantage of WP Rocket is that it comes with more built-in speed optimizations than other cache plugins. This not only means less plugins running on your WordPress site, but better speed optimizations and GTmetrix scores. That’s why it’s usually #1 in Facebook polls.

WP Rocket Heartbeat Control Settings

 

4. Disable Heartbeat With Perfmatters

You can also use the Perfmatters Plugin (by Kinsta) to disable the WordPress Heartbeat. This plugin also lets you selectively disable plugins, scripts, and styles from loading on certain pages, limit post revisions, and disable many unnecessary things in the WordPress admin. I use it on my own website and like to say “it takes care of the last 10% of your WordPress speed.”

Permatters Heartbeat Control Settings

 

5. Disable Heartbeat With Clearfy

Clearfy does little bits of speed optimization, security, and SEO.

They also have an option to disable Heartbeat, but it also does a good job of cleaning up trash in your WordPress admin. Take a look at the plugin page as it has many “miscellaneous features” that can help your fix a slow WordPress site and improve both your security + SEO.

Clearfy Disable Heartbeat Control

 

What’s Next?

I have some great resources on WordPress speed optimization:

And many more which you can find below.

Hope this was helpful! Comment if you need any help at all.

Cheers,
Tom

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments