In this article, we will continue talking about useful tips to improve website performance. We’ve already discussed how to Disable Admin Bar In WordPress for everyone but admins. The next tip for better performance is to configure Heartbeat in WordPress.

Heartbeat has a few useful features. For example, it can temporarily block access the posts edited by other registered users. However, if a website owner does all content management work, then this feature is not so useful. That’s why you can disable it. Heartbeat is also responsible for autosave. And, again, if you save changes manually, this feature is hardly useful for you. We’ve discussed how to disable autosave in the previous post.

How Heartbeat In WordPress Works

Heartbeat implements a permanent connection between a browser where the post is being edited and a server.

The technical aspect is this: every half a minute almost all admin pages send requests to admin-ajax.php. If you’ve opened several tabs with the admin console, the requests will be sent from them all. So you can imagine the load it produces on the website.

Disable Heartbeat With A Plugin

The multifunctional optimizer Clearfy has many useful tools. For example, you can disable Heartbeat in WordPress. Or you can define a certain interval for Heartbeat requests to minimize the server load.

Download the plugin and go to its settings.

Settings => Clearfy menu.

How To Configure And Manage Heartbeat In WordPress

Go to Advanced. There you’ll see all the necessary options. Choose where to disable Heartbeat from (dashboard, for editing posts or everywhere).

How To Configure And Manage Heartbeat In WordPress

In case you don’t want to fully disable Heartbeat, just select a new time interval for sending requests from the drop-down menu.

How To Configure And Manage Heartbeat In WordPress

We recommend the value of 60 seconds. In our opinion, it’s the most suitable interval. Save the changes.

If for some reasons you’d like to get the autosave option back, or, perhaps, now several users can edit posts, feel free to reverse the settings by clicking Disable Heartbeat “By default”.

Disable Heartbeat With Code

To disable Heartbeat in WordPress using code, you should modify functions.php. You can do so through FTP or a file manager.

Add the following key in a separate line. Please, note that this snippet should be added to the beginning of the file and after the <?php tag:

add_action('init', 'stop_heartbeat', 1);

function stop_heartbeat() {
 wp_deregister_script('heartbeat');
 }

If you’ve done everything right you’ll successfully disable heartbeat in WordPress.

Conclusion

Each option has its benefits. However, if you are not a professional developer and prefer using the code, you may face some difficulties in finding the functions.php file. Besides, you can accidentally add extra symbols to the code, and the snippet won’t work correctly. The only downside of the plugin is that it should be installed first. But it’s super easy, actually. Search for Clearfy in the Plugins menu from the admin dashboard, or go to WordPress repository, or install the plugin from the official website. Don’t forget to visit clearfy.pro for useful tips about plugin features.

Scroll to Top