Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to control the WordPress Heartbeat

The WordPress Heartbeat can use a lot of server power. This guide shows how to slow it down or limit it.

WordPress2 min read8 steps

What is the Heartbeat API?

The Heartbeat is a small message your browser sends to the server every 15 to 60 seconds. It works like a pulse. It keeps your login alive, saves posts as you type and warns you when another person edits the same post.

Each pulse is a request to your server. Many open dashboard tabs can mean many requests. That can slow a small hosting plan.

Option 1: Use a plugin

A plugin is an add-on for WordPress. The Heartbeat Control plugin is a simple choice.

  1. Log in to your WordPress dashboard.
  2. Go to Plugins and then Add New.
  3. Search for Heartbeat Control.
  4. Click Install Now and then Activate.
  5. Open its settings page, often found under Settings.
  6. For each place (dashboard, post editor, front end), pick Allow, Modify or Disable.
  7. If you pick Modify, set a longer time, such as 60 seconds.
  8. Save your changes.

Option 2: Add code

Warning: Back up your site first. A typing mistake in code can break your site.

You can add code to your theme's functions.php file. A child theme is the safest place, because updates will not erase your change. To slow the Heartbeat to 60 seconds, add this:

add_filter( 'heartbeat_settings', function ( $settings ) {
    $settings['interval'] = 60;
    return $settings;
} );

This tells WordPress to send one pulse every 60 seconds. WordPress allows values from 15 to 120 seconds.

To switch it off everywhere except the post editor, add this:

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

This removes the Heartbeat script on all other admin pages.

What happens if you disable it?

You lose autosave and post locking in the places you turn it off. In the post editor, it is best to keep it on but slow.

Tip: Close dashboard tabs you do not use. Each open tab sends its own pulses.

Quick recap

  • The Heartbeat is a regular message from your browser to the server.
  • Too many pulses can slow your site.
  • Use a plugin or a short code to slow or limit it.
  • Keep it on in the post editor so autosave works.