Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Wordpress

WordPress: Speed Up Admin Dashboard by Disabling Heartbeat API

- 03.02.26 - ErcanOPAK

WordPress admin panel sluggish and using 100% CPU? The Heartbeat API polls your server every 15 seconds for autosave and notifications, eating resources.

What Heartbeat Does:

Every 15 seconds:
- Check for new comments
- Check for plugin updates  
- Autosave post drafts
- Notify about other users editing same post
- Trigger scheduled tasks

Result: 240 requests per hour per admin user
On busy sites: Server struggles, admin panel freezes

The Fix – Disable Heartbeat:

Add to functions.php (or use plugin “Heartbeat Control”):

// Completely disable Heartbeat
add_action('init', function() {
    wp_deregister_script('heartbeat');
}, 1);

Better: Control It Instead of Disabling:

// Slow down Heartbeat to 60 seconds (instead of 15)
add_filter('heartbeat_settings', function($settings) {
    $settings['interval'] = 60; // seconds
    return $settings;
});

// Disable Heartbeat on frontend (keep for admin)
add_action('init', function() {
    if (!is_admin()) {
        wp_deregister_script('heartbeat');
    }
}, 1);

// Disable everywhere except post editor
add_action('init', function() {
    global $pagenow;
    if ($pagenow != 'post.php' && $pagenow != 'post-new.php') {
        wp_deregister_script('heartbeat');
    }
}, 1);

Performance Impact:

Before (15 sec interval):
- 240 requests/hour/user
- 10 active admins = 2400 requests/hour
- Each request: 50-200ms server time
- Total server load: 2-8 minutes CPU per hour

After (60 sec interval):
- 60 requests/hour/user  
- 10 active admins = 600 requests/hour
- 75% reduction in background load
- Admin dashboard feels snappier

Side Effects of Disabling:

❌ No autosave while writing posts
❌ Won’t see “User X is editing this post” warnings
❌ Comment moderation notifications delayed
✅ But: Admin dashboard 3-5x faster
✅ Server load reduced by 60-80%

Recommended Setup:

// Disable on frontend (visitors don't need it)
add_action('init', function() {
    if (!is_admin()) {
        wp_deregister_script('heartbeat');
    }
});

// Slow down in admin dashboard
add_filter('heartbeat_settings', function($settings) {
    $settings['interval'] = 60;
    return $settings;
});

// Keep normal speed in post editor (for autosave)
add_filter('heartbeat_settings', function($settings) {
    global $pagenow;
    if ($pagenow == 'post.php' || $pagenow == 'post-new.php') {
        $settings['interval'] = 15; // Keep fast for editing
    }
    return $settings;
});

Alternative: Use Plugin

Install “Heartbeat Control” plugin:
– GUI to control Heartbeat per page
– No code needed
– Can set different intervals for dashboard/frontend/editor

Check If Heartbeat Is The Problem:

Open browser DevTools → Network tab → Filter: “heartbeat”
If you see requests every 15 seconds consuming 200-500ms, it’s the culprit!

// Typical Heartbeat request:
POST /wp-admin/admin-ajax.php
Action: heartbeat
Response time: 250ms
Every 15 seconds

= Noticeable slowdown on slower servers

Related posts:

WordPress: Create Custom Widget Areas with register_sidebar()

WordPress: Create Custom Widget Areas with register_sidebar()

WordPress: Fix a Plugin Update That Silently Breaks Because It Only Deployed to Some Servers in a Lo...

WordPress: Fix a Plugin Update That Silently Breaks Because It Only Deployed to Some Servers in a Lo...

Wordpress: Fix the REST API Returning 403 for Logged-In Editors

WordPress: Fix the REST API Returning 403 for Logged-In Editors

Views: 21
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Photoshop: Fix Blurry Text After Transform with This One Setting
WordPress: Limit Login Attempts Without Plugins Using .htaccess

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Read

  1. 01How to make theater mode the default for Youtube 1,079 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 868 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 671 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 584 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 562 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com