Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  WordPress FAQ  >  How To Set Frequency Of WordPress Heartbeat And Limit Executions?
Top Scroll

How To Set Frequency Of WordPress Heartbeat And Limit Executions?

 2 min

The WordPress 3.6 version launched the WordPress Heartbeat API. WordPress Heartbeat API enables the communication of your browser and the server while you are logged into the WordPress admin panel. This feature enables WordPress to manage various aspects like letting the other author know that a particular post is being edited by some other user, the plugins can also use the script executions and thereby you can get notifications in real time etc.

Even though the WordPress Heartbeat API looks like a great feature, it might cause some issues in some situations. The Heartbeat makes checks at different time periods on different pages of your website – like for the post edits, it makes a check in every 15 minutes and on the Dashboard, the check is made every minute etc. Every ‘tick’ made by the Heartbeat creates a POST request that adds to the number of your executions and it also adds to the CPU time used.

The WordPress Heartbeat feature makes use of the wp-admin/admin-ajaz.php file in order to make the AJAX calls. If you notice that a large number of POST requests are generated by that file, it means that you have to limit the work of Heartbeat or you need to stop it completely.

How To Limit Heartbeat?

It is possible to limit the execution frequency of WordPress Heartbeat. This can be done by making use of a plugin known as ‘Heartbeat Control’.

  • Install the Heartbeat Control plugin and activate it
  • Now go to ‘Settings’ and click on ‘Heartbeat Control Settings’
  • From the ‘Heartbeat Behavior’ drop down menu, select ‘Modify Heartbeat’
  • Select all the ‘Locations’
  • From the ‘Frequency’ slider, select 60 or above
  • Save the settings

When the settings are saved, you will override the Heartbeat execution frequency that is set by default. The frequency will be set to the value that you set through the Frequency slider.

How To Disable Heartbeat?

You can disable WordPress Heartbeat by selecting the option ‘Disable Heartbeat’ from the ‘Heartbeat Behavior’ drop down menu and enable all the ‘Locations’. This will disable the use of Heartbeat feature on all the pages of your website.

How To Stop Heartbeat Completely?

If you no longer wish to work with the WordPress Heartbeat feature, you can stop it completely. For doing this, you have to edit the ‘functions.php’ file of your theme and paste the lines mentioned below right after opening the ‘<?php’ tag:

add_action( ‘init’, ‘stop_heartbeat’, 1 );

function stop_heartbeat() {

wp_deregister_script(‘heartbeat’);

}

This will completely stop Heartbeat from working on your website and it will no longer add to the number of executions and the CPU time utilized for your account.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.