Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Limit Heartbeat API in WordPress

WordPress Heartbeat API is a great feature and opens the door to some great possibilities for plugin developers. However in some cases, it can increase your CPU usage and slow down your website. In this article, we will show you how to limit Heartbeat API in WordPress or even completely stop it.

WordPress HeartBeat API

Introduced in WordPress 3.6, Heartbeat API allows your browser to communicate with the server using AJAX calls when you are logged into WordPress admin area. This allows WordPress to show other authors that a post is being edited by another user and enable plugin developers to show you notifications in real-time.

This sounds great but if you have too many requests, then your server will slow down. Let’s take a look at how to limit or completely stop WordPress Heartbeat API.

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

First thing you need to do is install and activate the Heartbeat Control plugin. Upon activation, you need to visit Settings » Heartbeat Control to configure the plugin.

Settings page for heartbeat control plugin

From the ‘Control heartbeat locations’ option, you can select where you want to control heartbeat settings. You can disable it on dashboard, allow it on post edit pages, or completely disable it everywhere.

Changing heartbeat api call intervals

The next option allows you to control the frequency of heartbeat. By default, heartbeat makes a post call every 15 seconds on post edit pages, and every minute on the dashboard. You can choose a higher frequency.

Click on the save changes button to store your settings. That’s all you have successfully limited heartbeat API calls on your site.

Disable Heartbeat API in WordPress Without a Plugin

If you are a single user on your site, and you are sure that you will not be needing any features made possible by the API, then you can disable it. You can use heartbeat control plugin, we mentioned above, or you can simply copy and paste this code snippet into your theme’s functions.php file or in a site-specific plugin.

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

We hope this article helped you learn how to limit heartbeat API in WordPress. You may also want to checkout these tips and hacks to protect WordPress admin area.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

11 CommentsLeave a Reply

  1. Jiří Vaněk

    Can the heart beat have an impact on generating URLs in WordPress? I disabled the heart beat on my website using the WP Rocket plugin. Unfortunately, I then started experiencing that WordPress would “forget” the URLs of pages, and it began returning a 404 error for every existing page. I always had to regenerate the permalinks. However, the error reappeared after some time. In the end, turning the heart beat back on helped. After that, the issues stopped.

    • WPBeginner Support

      It should not unless there is something specific to your site that is using the Heartbeat API to generate the post URL.

      Admin

      • Jiří Vaněk

        Yes, I do. I use Polylang for language mutations on the website. The issues occurred only in one language mutation, not in the other. I think the problem was in the URL because the English language mutation had “/en” in the URL, while the Czech mutation did not have this suffix at the end. Therefore, disabling the heart beat may have had such an effect. However, thank you for the response; at least I will know that I can disable the heart beat on another website without necessarily encountering such issues again.

  2. Arize

    Also i am running a membership site and so many people will be logged in at the same time. Is it OK to disable it?

  3. Jaswinder Kaur

    Nice article with good information!!

    I want to use it for my site, but the plugin suggested by you, is not activated for a year. Please can you suggest something else.

  4. Dave Kessler

    Is there any possibility of this impacting SEO results?

  5. O. Live

    Yes!

    Thank you so much. My site crashed last night, and after a couple of hours on support with HostGator told me that I needed to solve this issue.

    Adding the plugin shaved two full seconds off homepage load time (4sec -> 1.9sec), and about 200kb off of total page size, and a 2-point bump in PageSpeed score.

    THANK YOU.

  6. Kien

    I use the plugin kk star ratings follow your instructions are not removed admin-ajax.php

  7. Blair2004

    WPBeginner is not only about beginners tutorials…

  8. Kate_H

    This article, whilst informative, seems to be a little misplaced on a website named WPbeginner…

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.