Table of Contents
Understanding the WordPress Heartbeat API
The WordPress Heartbeat API is a powerful feature that allows real-time communication between the web browser and the server. It is primarily used for functionalities such as auto-saving posts, showing real-time notifications, and updating the status of your user sessions. However, while these features enhance user experience, the frequent requests made by the Heartbeat API can lead to increased CPU usage, particularly on shared hosting environments.
Why Limit the Heartbeat API?
If you notice your hosting server is struggling with high CPU loads, especially during peak hours, the Heartbeat API could be a contributing factor. It sends requests to 'admin-ajax.php' every 15-60 seconds by default, which can unnecessarily strain your server resources. Reducing the frequency of these requests or disabling the API altogether can mitigate these issues and improve overall performance.
Steps to Limit or Disable the Heartbeat API
Method 1: Using a Plugin
One of the easiest ways to manage the Heartbeat API is through a plugin. For this, you can use the 'Heartbeat Control' plugin.
- 1. Install the Heartbeat Control plugin from the WordPress Plugin Repository.
- 2. Activate the plugin from your WordPress dashboard.
- 3. Navigate to the 'Settings' > 'Heartbeat Control' menu.
- 4. Here, you can choose to limit the Heartbeat API requests by adjusting the settings. You can set the frequency of requests to a longer interval, such as every 60 seconds, or even disable it in certain contexts (like the post editor).
- 5. Save the changes.
Method 2: Manual Code Adjustment
If you prefer not to use a plugin, you can manually adjust the Heartbeat API settings by adding code to your theme's functions.php file.
// Limit Heartbeat API Frequency
add_action( 'heartbeat_init', 'modify_heartbeat' );
function modify_heartbeat() {
wp_enqueue_script( 'heartbeat' );
wp_localize_script( 'heartbeat', 'heartbeatSettings', array(
'interval' => 60 // Set interval to 60 seconds
));
}
This code snippet sets the Heartbeat API to send requests every 60 seconds instead of the default interval, significantly reducing CPU load.
Testing and Monitoring CPU Usage
After implementing either of the methods above, it’s crucial to monitor your website’s CPU usage. Use tools like New Relic or your hosting provider’s built-in monitoring tools to analyze performance and resource consumption. Look for a decrease in CPU load and ensure that your site functionality remains intact.
Potential Drawbacks of Disabling the Heartbeat API
While limiting the Heartbeat API can help save CPU resources, be aware that it might affect certain functionalities. For instance, features like post auto-saving and real-time notifications may be delayed or disabled. Therefore, it’s essential to strike a balance between performance and user experience.
Conclusion
The WordPress Heartbeat API is a useful feature, but it can lead to increased CPU usage if not managed properly. By following the steps outlined above, you can effectively limit or disable the Heartbeat API to reduce CPU load on your hosting server. Regularly monitor your site's performance to ensure that the changes have the desired effect without adversely impacting functionality.

Work with Figmantor
We are an experienced team of experts in AI integrations, WordPress development, Showit customizations, and Next.js web development. From fixing bugs and optimizing speed to converting designs into production-ready platforms, we handle your project end-to-end with premium code quality.
Related Articles
How to Convert Figma to Elementor WordPress — Complete Guide 2026
Learn the complete step-by-step process for converting Figma designs into pixel-perfect WordPress Elementor websites. Covers design audits, asset optimizations, containers, and QA.
ShowitFigma to Showit: Build Stunning Showit Websites From Your Designs
Discover how to transform your Figma mockups into beautiful, drag-and-drop Showit websites. Learn the custom canvas settings, mobile-first design, and WordPress blog styling.
