How to Disable WordPress Heartbeat Executions by Setting Limits

January 8, 2024 / WordPress

This article will explain how to disable WordPress heartbeat executions by setting limits. WordPress Heartbeat API allows your browser to connect with the server when you are logged into the WordPress admin panel.

Let us find out how to stop heartbeat completely, follow the steps-

  1. Mostly, you can disable heartbeat completely if you are the only person occupied at any given stage in your site and you know that you do not have any significant functionality that greatly relies on it to work properly.
  2. Edit the file “function.php” of your theme and paste these lines right after the opening php tag-
    add_action( ‘init’, ‘stop_heartbeat’, 1 );
    function stop_heartbeat() {
    wp_deregister_script(‘heartbeat’);
    }
  3. This will effectively deactivate this feature, preventing it from contributing to the total number of executions and CPU time usage in your account.

This way, you can disable WordPress heartbeat executions by setting limits. You can also increase the WordPress memory limit in cPanel flawlessly to run heavier plugins.

Spread the love