{"id":4260,"date":"2022-05-05T10:27:06","date_gmt":"2022-05-05T07:27:06","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=4260"},"modified":"2025-12-05T16:57:40","modified_gmt":"2025-12-05T14:57:40","slug":"how-to-limit-the-wordpress-heartbeat-api","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-to-limit-the-wordpress-heartbeat-api\/","title":{"rendered":"How to Limit the WordPress Heartbeat API?"},"content":{"rendered":"\n<p><span style=\"font-weight: 400;\">Many <\/span><b>WordPress users <\/b><span style=\"font-weight: 400;\">can improve the performance of their website on <\/span><a href=\"https:\/\/www.scalahosting.com\/web-hosting-for-small-business.html\"><b>shared hosting plans<\/b><\/a><span style=\"font-weight: 400;\"> by limiting the default settings of the <\/span><b>Heartbeat API<\/b><span style=\"font-weight: 400;\">. The functionality of the Heartbeat API is related to the <\/span><i><span style=\"font-weight: 400;\">\/wp-admin\/admin-ajax.php<\/span><\/i><span style=\"font-weight: 400;\"> file.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">This guide will explain the basic settings options.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">The <\/span><a href=\"https:\/\/developer.wordpress.org\/plugins\/javascript\/heartbeat-api\/\"><span style=\"font-weight: 400;\">Heartbeat API<\/span><\/a><span style=\"font-weight: 400;\"> uses AJAX calls to synchronize content, plugins, and other information when multiple users are active on a WordPress site. Turning off the Heartbeat API can <\/span><a href=\"https:\/\/www.scalahosting.com\/blog\/how-to-speed-up-a-wordpress-website\/\"><b>improve WP performance<\/b><\/a><span style=\"font-weight: 400;\"> by reducing the total number of PHP calls made to a server.&nbsp;<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Table of Contents:<\/b><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><b> What is WordPress Heartbeat?<\/b><\/li>\n\n\n\n<li><b> What is WordPress Heartbeat used for?<\/b><\/li>\n\n\n\n<li><b> How to Configure WordPress Heartbeat?<\/b><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>How to Limit the Heartbeat API?<\/b><\/li>\n\n\n\n<li><b>How to Stop Heartbeat Completely?<\/b><\/li>\n\n\n\n<li><b>Other Heartbeat API Settings<\/b><\/li>\n<\/ul>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><b> When might Heartbeat be harmful to your website?<\/b><\/li>\n\n\n\n<li><b> Conclusion<\/b><\/li>\n\n\n\n<li><b> FAQ<\/b><\/li>\n<\/ol>\n\n\n\n<p><span style=\"font-weight: 400;\">The Heartbeat API has been part of WordPress core <\/span><b>since version 3.7<\/b><span style=\"font-weight: 400;\">. Multiple third-party plugins<\/span><b> available for WordPress<\/b><span style=\"font-weight: 400;\"> allow admins to limit or completely turn off the functionality.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">ScalaHosting recommends looking into the Heartbeat Control plugin by <\/span><a href=\"https:\/\/www.scalahosting.com\/blog\/wp-rocket-wordpress-plugin\/\"><b>WP Rocket<\/b><\/a><span style=\"font-weight: 400;\">and the <\/span><a href=\"https:\/\/perfmatters.io\/\" rel=\"nofollow\"><span style=\"font-weight: 400;\">Perfmatters<\/span><\/a><span style=\"font-weight: 400;\">plugin as two of the best tools to control the Heartbeat API.\u00a0<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>What is WordPress Heartbeat?<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">The Heartbeat API represents <\/span><b>a JQuery event that is scheduled in the WordPress core<\/b><span style=\"font-weight: 400;\"> whenever a user is logged into the admin account. The <\/span><b>API functionality<\/b><span style=\"font-weight: 400;\"> has three main aspects:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>JS heartbeat-send event: <\/b><span style=\"font-weight: 400;\">Developers can add variable data to the communication<\/span><\/li>\n\n\n\n<li><b>Heartbeat_received filter: <\/b><span style=\"font-weight: 400;\">The <\/span><b>AJAX code is processed by PHP<\/b><span style=\"font-weight: 400;\">, updating the CMS.<\/span><\/li>\n\n\n\n<li><b>JS heartbeat-tick:<\/b><span style=\"font-weight: 400;\"> The process confirmation is returned to the source plugin.<\/span><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400;\">Developers can incorporate the Heartbeat API functionality into custom plugins to ensure that information is being updated across active website users in real-time. This allows multiple users to edit the same content simultaneously, with<\/span><b> CMS updates communicated every 15-20 seconds.<\/b><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>What is WordPress Heartbeat used for?<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">The WordPress API can display <\/span><b>which users are actively editing a page at the same time<\/b><span style=\"font-weight: 400;\"> in the CMS. The functionality can relay <\/span><b>content updates with timestamps<\/b><span style=\"font-weight: 400;\"> that are logged by page analytics. Developers can <\/span><b>customize queries<\/b><span style=\"font-weight: 400;\"> to relay real-time update messages to users.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Still, the Heartbeat API is primarily utilized to <\/span><b>auto-save content<\/b><span style=\"font-weight: 400;\"> when it is in the process of being edited. It can also log <\/span><a href=\"https:\/\/www.scalahosting.com\/blog\/how-to-install-woocommerce\/\"><b>WooCommerce shopping cart<\/b><\/a><span style=\"font-weight: 400;\"> information in real-time for analytics purposes. On top of it all, developers can extend the functionality as per the requirements of their plugins.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>How to Configure WordPress Heartbeat?<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">The main problem with the Heartbeat API is that it can needlessly<\/span><b> increase PHP processing <\/b><span style=\"font-weight: 400;\">requirements on a shared server, and there is no default administration for the service in the WP core.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">In such cases, web developers can use third-party solutions or disable the API altogether.<\/span><\/p>\n\n\n\n<p><b>WP Rocket and Perfmatters<\/b><span style=\"font-weight: 400;\"> both produce proprietary performance optimization plugins for WordPress.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">The <\/span><a href=\"https:\/\/wordpress.org\/plugins\/heartbeat-control\/\"><span style=\"font-weight: 400;\">Heartbeat Control plugin<\/span><\/a><span style=\"font-weight: 400;\"> from WP Rocket is part of the larger suite and is a <\/span><b>free solution<\/b><span style=\"font-weight: 400;\"> with <\/span><b>more than 100,000 active installations<\/b><span style=\"font-weight: 400;\"> to date. This is one of the most popular go-to choices to control the Heartbeat API settings on a WordPress site.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">A <\/span><b>full WP Rocket plugin subscription<\/b><span style=\"font-weight: 400;\"> for WordPress costs <\/span><b>$49 for a single website<\/b><span style=\"font-weight: 400;\">. In comparison, the Perfmatters solution comes at <\/span><b>$24.95 per year for one site<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>How to Limit the Heartbeat API?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">To limit the Heartbeat API we have to install the appropriate add-on, in our case &#8211;<\/span><b> Heartbeat Control <\/b><span style=\"font-weight: 400;\">from WP Rocket.<\/span><b>&nbsp;<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">To do this, navigate to the <\/span><b>\/wp-admin <\/b><span style=\"font-weight: 400;\">section of your WordPress website. Under the <\/span><b>Plugins<\/b><span style=\"font-weight: 400;\"> tab, select the link that states <\/span><b>Add New<\/b><span style=\"font-weight: 400;\">. This should lead to <\/span><b>\/wp-admin\/plugin-install.php<\/b><i><span style=\"font-weight: 400;\">.<\/span><\/i><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Next, type <\/span><i><span style=\"font-weight: 400;\">Heartbeat Control<\/span><\/i> <span style=\"font-weight: 400;\">into the search box under keywords. You should see:<\/span><\/p>\n\n\n<div class=\"wp-block-image mpg-gallery\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"1024\" height=\"316\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image1-1024x316.jpg\" alt=\"How to Limit the WordPress Heartbeat API?, How to Limit the Heartbeat API?\" class=\"wp-image-4265\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image1-1024x316.jpg 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image1-300x93.jpg 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image1-768x237.jpg 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image1-1536x474.jpg 1536w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image1.jpg 1664w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n<\/div>\n\n\n<p><span style=\"font-weight: 400;\">Now, click on the <\/span><b>Install Now<\/b><span style=\"font-weight: 400;\"> button to add the plugin to your website. Hit the <\/span><b>Activate<\/b><span style=\"font-weight: 400;\"> button on the screen afterward.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">You should now see a link under the <\/span><b>Settings<\/b><span style=\"font-weight: 400;\"> tab that leads to <\/span><i><span style=\"font-weight: 400;\">Heartbeat Control<\/span><\/i><span style=\"font-weight: 400;\">. Click on it to enter the administration section of the plugin. The main control panel looks like that:<\/span><\/p>\n\n\n<div class=\"wp-block-image mpg-gallery\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"1024\" height=\"817\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image2-1024x817.jpg\" alt=\"How to Limit the WordPress Heartbeat API?, How to Limit the Heartbeat API? 2\" class=\"wp-image-4263\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image2-1024x817.jpg 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image2-300x239.jpg 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image2-768x613.jpg 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image2.jpg 1104w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n<\/div>\n\n\n<p><span style=\"font-weight: 400;\">The main options here are to <\/span><b>allow<\/b><span style=\"font-weight: 400;\">, <\/span><b>disable<\/b><span style=\"font-weight: 400;\">, or <\/span><b>modify <\/b><span style=\"font-weight: 400;\">the Heartbeat API for the <\/span><a href=\"https:\/\/www.scalahosting.com\/blog\/navigating-your-wordpress-dashboard\/\"><b>WP Dashboard<\/b><\/a><span style=\"font-weight: 400;\">, <\/span><b>Frontend, or Post Editor. Administrators <\/b><span style=\"font-weight: 400;\">can also configure the settings that best represent the workflow of their publishing community or writers without any complex coding requirements.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>How to Stop Heartbeat Completely?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">If you prefer not to install a third-party plugin dependency, it is possible to completely disable the functionality of the <\/span><b>Heartbeat API in WordPress<\/b><span style=\"font-weight: 400;\"> <\/span><span style=\"font-weight: 400;\">using a few lines of code in the <\/span><b>functions.php<\/b> <span style=\"font-weight: 400;\">file. To use this method, find and edit the <\/span><i><span style=\"font-weight: 400;\">functions.php<\/span><\/i><span style=\"font-weight: 400;\">file to include the lines:<\/span><\/p>\n\n\n\n<figure class=\"wp-block-table alert-orange is-style-regular\">\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">add_action( <\/span><span style=\"font-weight: 400;\">&#8216;init&#8217;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8216;stop_heartbeat&#8217;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\"> );<\/span><span style=\"font-weight: 400;\"><br \/><\/span><span style=\"font-weight: 400;\">function<\/span> <span style=\"font-weight: 400;\">stop_heartbeat<\/span><span style=\"font-weight: 400;\">() {<\/span><span style=\"font-weight: 400;\"><br \/><\/span><span style=\"font-weight: 400;\">wp_deregister_script(<\/span><span style=\"font-weight: 400;\">&#8216;heartbeat&#8217;<\/span><span style=\"font-weight: 400;\">);<\/span><span style=\"font-weight: 400;\"><br \/><\/span><span style=\"font-weight: 400;\">}<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n\n<p><span style=\"font-weight: 400;\">The advantage of this approach is that it will <\/span><b>completely eliminate the CPU activity related to processing the Heartbeat API<\/b><span style=\"font-weight: 400;\"> <\/span><span style=\"font-weight: 400;\">on active WordPress websites in production. The downside is that you may lose functionality with modules that rely on the service or with multi-user post editing.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Other Heartbeat API Settings<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">The Heartbeat Control plugin also includes the ability to tinker with the period on <\/span><b>which API calls are implemented for the dashboard, frontend, and post editor<\/b><span style=\"font-weight: 400;\">. This allows you to create custom configurations for the Heartbeat API that preserve functionality while optimizing your WordPress website performance.<\/span><\/p>\n\n\n<div class=\"wp-block-image mpg-gallery\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"1024\" height=\"848\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image3-1024x848.jpg\" alt=\"How to Limit the WordPress Heartbeat API?, Other Heartbeat API Settings\" class=\"wp-image-4264\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image3-1024x848.jpg 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image3-300x248.jpg 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image3-768x636.jpg 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/05\/image3.jpg 1091w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n<\/div>\n\n\n<p><span style=\"font-weight: 400;\">The Heartbeat Control plugin includes options to <\/span><b>run the API for each service at intervals from 0 to 300 seconds<\/b><span style=\"font-weight: 400;\">. Experiment with these values to find the right balance for your site.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>When Heartbeat might be harmful to your website?<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">The <\/span><b>Heartbeat API is a core WordPress functionality<\/b><span style=\"font-weight: 400;\"> that is designed to harmonize website creation across teams that are using the CMS simultaneously for different workflow requirements. If you have many admin users and open new tabs, the API calls can easily spiral out of control.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">That\u2019s why, <\/span><b>WordPress administrators<\/b><span style=\"font-weight: 400;\"> need to monitor their usage logs and platform analytics to determine if the site performance is being affected adversely due to the Heartbeat API. Consider regulating the service if you receive too many AJAX POST requests from the <\/span><i><span style=\"font-weight: 400;\">\/wp-admin\/admin-ajax.php<\/span><\/i><span style=\"font-weight: 400;\"> file.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Conclusion<\/b><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">The WordPress Heartbeat API is a functional part of the<\/span><b> core CMS distribution<\/b><span style=\"font-weight: 400;\"> that can be extended with plugins to deliver update messages to users in real-time. The Heartbeat API is a WordPress admin <\/span><i><span style=\"font-weight: 400;\">ajax.php<\/span><\/i><span style=\"font-weight: 400;\"> service that you can turn off by adding code to the <\/span><i><span style=\"font-weight: 400;\">functions.php<\/span><\/i><span style=\"font-weight: 400;\"> file.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">You can easily <\/span><b>manage the API via the Heartbeat Control plugin from WP Rocket<\/b><span style=\"font-weight: 400;\">. The add-on also allows you to lower your CPU usage without the need to completely disable WordPress Heartbeat in <\/span><i><span style=\"font-weight: 400;\">wp-admin<\/span><\/i><span style=\"font-weight: 400;\">.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">ScalaHosting recommends disabling Heartbeat on WordPress sites if you start receiving too many post requests from the admin <\/span><i><span style=\"font-weight: 400;\">ajax.php <\/span><\/i><span style=\"font-weight: 400;\">file. You can also limit WordPress Heartbeat API settings with the Heartbeat Control plugin to <\/span><b>optimize your website for the best performance<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>FAQ<\/b><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Q: Why would I need to limit WordPress Heartbeat API services on a website?<\/b><\/h3>\n\n\n\n<p><b>A: <\/b><span style=\"font-weight: 400;\">If you have many admin users, content creators, or open tabs on a WordPress website <\/span><b>running on shared hosting, updating the WordPress dashboard for data synchronization and collaborative editing<\/b><span style=\"font-weight: 400;\"> can consume many resources. Turning the API off can optimize your CMS performance.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Q: Will turning off Heartbeat API affect WordPress admin or post editor?<\/b><\/h3>\n\n\n\n<p><b>A: Core functionalities and third-party plugins<\/b><span style=\"font-weight: 400;\"> that rely on the Heartbeat API will no longer operate if you turn off the service. Some functions might switch seamlessly, but others may generate errors, depending on their underlying code. In such cases, it is easier to limit Heartbeat or modify its timing frequencies to maintain your smooth workflow.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many WordPress users can improve the performance of their website on shared hosting plans by limiting the default settings of the Heartbeat API. The functionality of the Heartbeat API is related to the \/wp-admin\/admin-ajax.php file.&nbsp; This guide will explain the basic settings options. The Heartbeat API uses AJAX calls to synchronize content, plugins, and other [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"none","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-4260","post","type-post","status-publish","format-standard","hentry","category-web-hosting"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/4260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=4260"}],"version-history":[{"count":11,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/4260\/revisions"}],"predecessor-version":[{"id":5919,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/4260\/revisions\/5919"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=4260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=4260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=4260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}