Getting started · Let.com knowledge base

What is the WordPress Heartbeat API?

Updated 2024-08-222 min read

Hosting documentation. Account access is coming soon. Always use the server details and nameservers assigned to your own account.

WordPress Heartbeat API

First appearing in WordPress 3.6, the WordPress Heartbeat API allows your web browser to communicate with the actual web server. This "heartbeat" is sent over intervals continuously. While this allows functionality such as plugins being able display real-time updates as well other many other functions, it can cause extensive resource usage.

 

How Do I Know If This is Causing Performance Issues For My Site?

The WordPress Heartbeat uses the file wp-admin/admin-ajax.php to make AJAX calls. You can use a command such as Top from your cPanel's Terminal (or via SSH) to see if you notice a large amount of the admin-ajax.php file being ran by your site.

 

How Can I Disable This or Change How Often This Heartbeat Occurs?

If there are not multiple authors for your site (the heartbeat allows you to see if someone else is editing the same post), you may wish to simply disable this functionality completely. The WordPress Heartbeat can be disabled via many different methods:

Completely Disable WordPress Heartbeat (Will Be Disabled on any Theme):

This method would be the recommended method to utilize as unlike with editing your functions.php file, the heartbeat will remain disabled even when changing to a different theme.

Plugins_PHP.png

Once you have opened the plugins.php file, you may add the following code to the top of the file, and save:

add_action( 'init', 'kill_heartbeat', 1 ); function kill_heartbeat() { global $pagenow; wp_deregister_script('heartbeat'); } 

Completely Disable WordPress Heartbeat (Theme Specific):

You can edit your theme's function.php file to completely disable the WordPress Heartbeat only when using a specific theme.

cPanel-File-Manager-v3.png

Once you have opened the functions.php file, you may add the following code to the top of the file, and save:

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

Change The Interval In Which The Heartbeat Occurs:

If you would like to change how often the Heartbeat Occurs, rather than disable it you can use also use your functions.php file as mentioned above, and add the following code:

add_filter( 'heartbeat_send', 'my_heartbeat_settings' ); function my_heartbeat_settings( $response ) { if ( $_POST['interval'] != 60 ) { $response['heartbeat_interval'] = 60; } return $response; } 

*Please note that the above code sets the interval to 60 seconds (the default interval is 15 seconds). This may be adjusted accordingly.

 

Alternatively, there is the third party plugin HeartBeat Control which allows you to due this through a simple plugin interface. The following third party Youtube Link will provide details regarding the many features available from the plugin: https://www.youtube.com/watch?v=of0GCD_mlMs 

Did this point you in the right direction?

Talk to the Let.com team

Frequently asked questions

What you need to know.

Talk to our team

What does the WordPress Heartbeat API support?

It provides repeated communication between the browser and server for features such as real-time updates and detecting when another author is editing a post.

Which activity does the guide inspect when investigating Heartbeat load?

It points to repeated admin-ajax.php activity in process monitoring as a place to investigate when the site is using excessive resources.

Does the article discuss reducing Heartbeat frequency as well as disabling it?

Yes. It presents interval changes and a plugin-based control option alongside disabling methods. Consider the site features that rely on Heartbeat before choosing a change.

Let.com

Coming soon.

Account sign-up, log-in and checkout are not available yet. You can explore our products and compare plans while we get everything ready.

Compare plans