High-Performance Web Hosting

  • SSD Storage
  • Daily Backups
  • 1-click WordPress
  • 24/7 Support

COUPON
hello15

1st Month $1 Only

Get started →

How to limit and control WordPress Heartbeat API

What is The Heartbeat API?

WordPress introducted heartbeat API in WordPress 3.6, which allows WP to communicate between the browser and the hosting server. It's responsible for user session managament, revision tracking and auto saving. However in most cases, heartbeat API can lead to an increase in your CPU/memory usage and slow down your website. If your WordPress install is using too many resources and you see /wp-admin/admin-ajax.php as the culprit, it’s because of the Heartbeat API.

In this article, we will show you how to limit Heartbeat API in WordPress or completely disable it.

How Heartbeat API works in WordPress

The Heartbeat API uses /wp-admin/admin-ajax.php to run AJAX calls from the web-browser. If you watch the server requests while using post editor, you will see POST /wp-admin/admin-ajax.php "http://yourdomain.com/wp-admin/index.php appear every 15 seconds. If the heartbeart request takes 30 seconds or longer, WordPress will display a connection error and reattempt the connection to the server.

This can quickly turn into an a problem everytime your web browser is left open on any WordPress page using the heartbeat API, the heartbeat API starts to send excessive requests to admin-ajax.php which leads to high CPU usage.

How to limit the HeartBeat API in WordPress

  1. Login to your WordPress dashboard
  2. From the dashboard navigation menu select Plugins > Add New
  3. Type Heartbeat Control into the search box and press Enter to search.
  4. Click Install now beside the Heartbeat control plugin
  5. After the plugin is installed, click Activate Plugin
  6. Find plugin settings Under Settings > Heartbeat Control 
  7. Change control heartbeat locations to "Allow only on post edit pages"

    wordpress heartbeat control plugin

  8. Change Override Heartbeat frequency from the dropdown to 60 seconds


    wp heartbeat plugin frequency


  9. Saves changes
That's it! WordPress HeartBeat API should not be adding excessive number of executions and hogging all your CPU resources when you leave your WP Dashboard open.

 


Was this answer helpful?
 Print this Article

Also Read