Disable Heartbeat API Without Plugin to stop unnecessary AJAX calls and reduce server load. Here’s how to disable it manually using your child theme.
Step 1: Add the Heartbeat API Disable Code
Add this code to your child theme’s functions.php:
add_action(‘init’, ‘qdt_stop_heartbeat’, 1);
function qdt_stop_heartbeat() {
wp_deregister_script(‘heartbeat’);
}
How It Works
This simple snippet removes the Heartbeat script, stopping the constant AJAX requests WordPress makes in the background.
Why Disable Heartbeat API Without Plugin?
Heartbeat API is useful for autosave but can drain CPU resources on busy sites. Disabling it helps speed up admin performance and lower hosting costs.
Common Mistake
Fully disabling Heartbeat API stops autosave for posts and pages. Be sure to test if you rely on this feature for drafts.
Pro Tip
Use a child theme for this Disable Heartbeat API Without Plugin tweak so it doesn’t get overwritten when updating your main theme.
Related Snippet
If you liked this, check out my guide on disabling XML-RPC without a plugin in WordPress.