In the WordPress site, theHeartbeat API together with Security plug-ins, firewalls, login authentication mechanisms (including 2FA) Conflicts between them are one of the high causes of background lag, frequent dropouts, editor anomalies, and even failure to save content.
Many webmasters will find that after enabling security plugins or strengthening login verification:
Failed autosave or repeated "Connection disconnected" messages
admin-ajax request blocked or delayed
These problems are not accidental, but Heartbeat's background polling mechanism creates a structural conflict with the security policyThe
I. What does Heartbeat actually do in the background?
The Nature of Heartbeat
Heartbeat is used by WordPress in the backend AJAX Polling MechanismThe main way to do this is through admin-ajax.php Periodically send requests to the server for:
Maintaining a login session (session)
Automatically save articles
Prevent multiple editors from editing at the same time
Synchronize background status
By default:
Background Heartbeat frequency:15-60 seconds
Higher frequency in editor mode
Heartbeat is strongly bound to the "login state".
This is one of the root causes of the conflict:
Heartbeat request = continuous authentication of logged-in users
Every Heartbeat request is, essentially, one:
Cookie Checksum
Session validity check
Confirmation of authority
These behaviors, in turn, happen to highly overlap with the scope of work of security plug-ins, WAFs, and 2FAs.
Second, the security plug-in / firewall is how to "accidentally hurt" Heartbeat?
The page prompts "save failed" or "need to log in again".
Symptoms seen on the surface by the user
Sudden exit from the background while editing a page
Cannot save after entering content
Elementor shows connection errors
Frequent jumps to the login page
These issues are often mistaken:
Server instability
Elementor Bug
Browser issues
In fact, the root cause is conflicting security policies.
Fourth, why is the front desk completely normal with visitors?
This is a very critical point of judgment.
The reason is simple:
Heartbeat primarily runs on wp-admin
Heartbeat is not triggered for frontend users
Firewalls are usually more lenient on frontend policies
So you'll see:
Website access speed is normal
Only the back office is "getting harder and harder to use."
V. Correct settlement principles (very important)
When dealing with Heartbeat conflicts with security plugins, theTwo extremes must be avoided::
❌ Direct shutdown of Heartbeat ❌ Disable security plug-ins completely or 2FA
The correct principle is:
Reducing the probability of conflict rather than sacrificing security
VI. Landable security optimization ideas (without affecting the front office)
Restrictions for backend only Heartbeat
Core idea:
Do not turn off Heartbeat
Reduce background frequency
Only works with wp-admin
This will do:
Dramatically reduce AJAX requests
Doesn't affect autosave core functionality
Reduce the probability of being misjudged by security plug-ins
"Release" in security plugin admin-ajax.php
It is recommended to check the following setting items:
admin-ajax Whether or not the flow is limited
Whether it is counted as a login failure
Involvement in violence prevention rules
best practice::
Relax admin-ajax restrictions for logged-in users
Retain strict policies for unlogged-in users
Setting up "Backend Edit Whitelist Logic" for 2FA
If your 2FA plugin supports it:
Triggered only at login 2FA
No duplicate validation during editing
Be sure to enable it.
Otherwise:
Heartbeat never passes secondary authentication
The backend experience will continue to be unstable
Aggressive Strategies for Reducing "Login State Expiration"
Some security plugins are set by default:
Forced session expiration for a short period of time
Background operation will expire after a while
Recommendation:
Reasonable extension of background session time
Ensure that editing of long pages is not interrupted
VII. How can I tell if the problem has been solved?
After optimization is complete, you should observe:
Backend editor is noticeably smooth
Autosave no longer fails
No more frequent logouts
Admin-ajax request in the browser Network panel returns 200 consistently.
If this holds true, Heartbeat and the security mechanism have entered a state of "peaceful coexistence".
VIII. Summarize: the essence is not a Bug, but a strategy conflict
Summarize this type of question in one sentence:
Heartbeat's conflict with security plugins / firewalls / 2FA is not a system bug by nature, it's Structural tension between high-frequency background polling and aggressive security policiesThe
The key to the solution is not "who to shut down", but rather:
Defining Heartbeat's backend role
Design a more logical security policy for logged-in users
No comments