{"id":946,"date":"2018-03-04T18:22:17","date_gmt":"2018-03-04T18:22:17","guid":{"rendered":"https:\/\/chemicloud.com\/kb\/?post_type=article&#038;p=946"},"modified":"2024-10-16T09:44:24","modified_gmt":"2024-10-16T09:44:24","slug":"disable-limit-wordpress-heartbeat","status":"publish","type":"ht_kb","link":"https:\/\/chemicloud.com\/kb\/article\/disable-limit-wordpress-heartbeat\/","title":{"rendered":"How to Disable or to Limit WordPress Heartbeat"},"content":{"rendered":"<p><strong>WordPress Heartbeat<\/strong> API is a simple server polling API built into WordPress, allowing near-real-time frontend updates.<\/p>\n<p><strong>\u00a0<\/strong>The<strong>\u00a0<\/strong>API\u00a0 is using the <strong>admin-ajax.php<\/strong> file to make AJAX calls. If you notice a significant amount of POST requests to that file, this means that you need to limit\u00a0WordPress Heartbeat frequency or to completely disable it.<\/p>\n<p>Sending excessive requests to\u00a0<strong>admin-ajax.php<\/strong>\u00a0can lead to high CPU usage.<\/p>\n<h2 id=\"how-to-disable-wordpress-heartbeat\">How to disable\u00a0WordPress Heartbeat<\/h2>\n<p>To completely disable it, go to the functions.php file of your WordPress theme and paste these lines right after the opening &lt;?php tag:<\/p>\n<p><code>add_action( 'init', 'stop_heartbeat', 1 );<br \/>\nfunction stop_heartbeat() {<br \/>\nwp_deregister_script('heartbeat');<br \/>\n}<\/code><\/p>\n<p>This will completely disable\u00a0this functionality and it will be no longer added to the total number of executions and CPU time used by your website.<\/p>\n<h2 id=\"how-to-limit-wordpress-heartbeat\">How to limit\u00a0 WordPress Heartbeat<\/h2>\n<p>In case you don&#8217;t want to disable it completely, you can simply limit its execution frequency. You can do this by using a plugin called <a href=\"https:\/\/wordpress.org\/plugins\/heartbeat-control\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\"><strong>Heartbeat\u00a0<\/strong><strong>Control.<\/strong><\/a><\/p>\n<p>Once you have installed the plugin you can decrease the Heartbeat frequency to 60 seconds or above. It is recommended to set Heartbeat locations to &#8220;Allow only on post edit pages&#8221;.<\/p>\n<h2 id=\"thats-a-wrap\">That\u2019s a wrap!<\/h2>\n<p>You now know how to completely disable or to limit\u00a0WordPress Heartbeat.<\/p>\n    \t\t<div class=\"hts-messages hts-messages--info    \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tIf you enjoyed this tutorial, then you\u2019ll love our support. All ChemiCloud\u2019s hosting plans include 24\/7 support from our amazing support team.<\/p>\n<p class=\"p1\">Check out our <a href=\"https:\/\/chemicloud.com\/managed-wordpress-hosting?utm_source=blog&amp;utm_medium=article#60b65e4e63b58\"><span class=\"s1\">Managed WordPress hosting<\/span><\/a>\u00a0plans and have your website migrated today!<\/p>\n    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n","protected":false},"excerpt":{"rendered":"<p>WordPress Heartbeat API is a simple server polling API built into WordPress, allowing near-real-time frontend updates. \u00a0The\u00a0API\u00a0 is using the admin-ajax.php file to make AJAX calls. If you notice a significant amount of POST requests to that file, this means that you need to limit\u00a0WordPress Heartbeat frequency or to completely&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"ht-kb-category":[40],"ht-kb-tag":[],"class_list":["post-946","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-wordpress"],"_links":{"self":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/comments?post=946"}],"version-history":[{"count":5,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/946\/revisions"}],"predecessor-version":[{"id":8508,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/946\/revisions\/8508"}],"wp:attachment":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/media?parent=946"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=946"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}