LevelNetwork Heartbeat Manager

外掛說明

Heartbeat Manager allows you to optimize your WordPress site’s performance by limiting or completely disabling the Heartbeat API calls.

The WordPress Heartbeat API uses AJAX calls (admin-ajax.php) to provide real-time information, such as when other users are editing a post or to show real-time notifications (like in WooCommerce). While useful, on many sites, especially E-commerce stores with high traffic, these frequent calls can put a significant strain on the server’s CPU.

This plugin allows you to granularly control this behavior via a simple settings card in Settings > Heartbeat Manager.

Key Features:

  • Backend Frequency Control: Increase or manage the “beat” interval while inside the WordPress Admin Dashboard.
  • Flexible Frontend Management: Choose whether to keep the Heartbeat API active on the public site or disable it completely.
  • Integrated Testing Guide: Includes a built-in step-by-step Vademecum in the sidebar to verify your settings via browser Developer Tools.
  • Lightweight & Translation Ready: Clean, lightweight code that is fully internationalized and ready for translation using the standard levelnetwork-heartbeat-manager text-domain.

Developed by sonofgod80 (LevelNetwork.it) to maximize site fluidity.

螢幕擷圖

安裝方式

  1. Upload the levelnetwork-heartbeat-manager folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Go to Settings > Heartbeat Manager to configure the values.

常見問題集

Will disabling the Heartbeat API break my site?

No, it will not break your site’s core layout. However, completely disabling it on the frontend might affect real-time updates from third-party plugins that rely on it (e.g., live notification badges or certain real-time WooCommerce cart dynamic updates). If you notice issues, you can change the setting from “Disabled” to a higher time interval (e.g., 60 or 120 seconds).

What is the recommended setting for an E-commerce store?

For maximum performance under high traffic, we highly recommend setting the Backend interval to 60 or 120 seconds, and setting the Frontend to “Disabled”. This drastically reduces the number of background AJAX requests (admin-ajax.php) hitting your server.

Why do I get an “Uncaught ReferenceError” or “undefined” error when testing the frontend in the browser console?

This is completely normal and actually a good sign! WordPress does not load the Heartbeat script on the public frontend by default. If you see this error, it means neither your theme nor any active plugins are currently triggering the Heartbeat API on your public pages. Your frontend is already naturally optimized and completely free of these background AJAX hits. The frontend custom interval setting will only apply if an asset explicitly requests the Heartbeat script.

Will a higher Post/Page Editor interval cause lag or sync issues in my Page Builder?

No, it won’t cause lag. However, if you increase the interval to the maximum (e.g., 300 seconds), your automatic backups (autosaves) will only happen every 5 minutes. If you are actively designing with heavy page builders, we highly recommend keeping the Post/Page Editor frequency at 30 or 60 seconds. This gives you the perfect balance: it drastically cuts down server resource usage while ensuring you don’t lose your layout changes if your browser crashes.

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈LevelNetwork Heartbeat Manager〉的開發相關工作。

參與者

將〈LevelNetwork Heartbeat Manager〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.0.3

  • Fix: Updated the Plugin Vademecum Section 1 to correctly reflect the new Post/Page Editor separation and prevent layout testing confusion.
  • Docs: Added a new FAQ regarding high editor intervals, page builders (Elementor, Divi, Gutenberg), and their impact on WordPress autosaves.

1.0.2

  • Tweak: Raised the minimum allowed interval for the Backend Frequency to 30 seconds (previously 15) to prevent accidental server CPU spikes from overly aggressive polling.
  • Docs: Updated the Plugin Vademecum & Testing Guide to clarify that frontend testing is only applicable when the theme or another plugin actively enqueues the Heartbeat API.

1.0.1

  • Enhancement: Fully internationalized (i18n ready) with default language set to English.
  • Enhancement: Added a comprehensive step-by-step “Plugin Vademecum & Testing Guide” section in the admin sidebar.
  • Fix: Completely refactored prefixing (changed short hm_ to unique lnhm_) across all constants, options, classes, and variables to ensure 100% compliance with WordPress.org guidelines and avoid collisions.
  • Fix: Greatly improved logic for handling frontend heartbeat intervals (disabling via inline script, changing frequency via standardized localization).
  • Fix: Added missing escaping (esc_attr, esc_html) and proper sanitization (intval) for better security.
  • Feature: Added “Settings” and “Donate” links directly beneath the plugin name in the plugins list.
  • Dev: Cleaned up CSS and separated layout structures to avoid class name conflicts with WordPress core.

1.0.0

  • Initial release.
  • Granular heartbeat control and dedicated UI.