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

The WordPress Heartbeat API should usually be disabled (or limited) because it consumes server resources.

However, WordPress Heartbeat is run on the frontend, backend, and editor. I would keep the backend heartbeat on, then limit the frontend/editor heartbeat by increasing the frequency to something like 60-120 seconds.

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 (this sends a request every 15 seconds), and other unneeded features.

The easiest way to disable WordPress Heartbeat is to install the Heartbeat Control plugin, view the settings, and modify the Heartbeat interval in the dashboard, frontend, or post editor, or disable it completely. Other methods include adding a few lines of code to your functions.php file or using a plugin that already has an disable Heartbeat option like WP Rocket or LiteSpeed.

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 you 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

 

5. Disable Heartbeat With LiteSpeed Cache

If you’re using the LiteSpeed Cache plugin, they also have an option to disable WordPress heartbeat in Toolbox → Heartbeat. You can edit the frontend, backend, and editor heartbeat.

Litespeed cache heartbeat settings

 

6. 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

 

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

About Tom Dupuis

Tom Dupuis writes WordPress speed and SEO tutorials out of his apartment in Denver, Colorado. In his spare time, he plays Rocket League and watches murder documentaries. Read his bio to learn 50 random and disturbing things about him.

4 thoughts on “How To Disable The WordPress Heartbeat API (The Easy Way)

  1. You have a new fan, Tom! :)

    I find your site very, very helpful, and I like the way you are serving the info – not all of us are pro.

    Not only that but you’ve won me with your bio, too, so that’s it, I stay! :)

    I believe that I have what to learn here.

    1. Haha thanks Alexandra! I spent a lot of time on the bio and did it out of pure enjoyment. I have a lot of updating to do on my articles but I’m constantly working on it. If you have any questions just lmk. I appreciate you :)

  2. Tom, thanks a lot! I suffered a lot from this feature with my hosting, the site constantly started giving 503 errors. By disabling the function, I overcame this. Thanks for the advice, everything works !!!

Leave a Reply

Your email address will not be published.