[an error occurred while processing the directive]


  • This mistake is preventing your blogging success
  • You cannot succeed without correcting it
  • 9 STEP PLAN to OVERCOME this mistake
  • Subscribe to my blog to get the ebook

How to resolve the WordPress connection lost issue with heartbeat control plugin

For new bloggers, server resource management is a major issue. Most new blogs are based on cost-effective shared hosts, which is understandable. You want to keep the running costs low.

heartbeat control plugin

But there is the obvious downside. Shared hosts have their limitations as they need to distribute the resource among all the hosted sites. Hundreds of sites are hosted on the same IP address, and hosts take every step to ensure that no one site abuses the resources.

So while its cost effective, you must be aware of the potential pitfalls (read: resource heavy stuff) that you need to avoid.

One major resource waster for WordPress blogs is the Heartbeat API. More on what it does later.

You should be more concerned about the problems it can create.

On shared hosts, this can often give you a “connection error” message on WordPress.

Even worse, this connection error due to Heartbeat API overusage can prevent you from editing your posts. It will give a message on these lines

Connection lost. Saving has been disabled until you’re reconnected. We’re backing up this post in your browser, just in case.

connection lost error due to heartbeat api

Connection lost error due to heartbeat api


 How to identify a Heartbeat API based issue?

You can roughly identify a case of Heartbeat API based issue by monitoring your admin-ajax.php usage.

Just run a site speed test on Pingdom and check the amount of time spent on admin-ajax.php. If there is indication of heavy admin-ajax.php usage, heartbeat API may be the culprit. In fact, your webhost may even notify you about excess resource usage through admin-ajax.php

What is Heartbeat API and what does it do?

Heartbeat API is a new feature that was released with WordPress 3.6. Here is what the developer had to say about it.

The purpose of this API is to simulate bidirectional connection between the browser and the server. Initially it will be used for autosave, post locking and log-in expiration warning while a user is writing or editing.

The idea is to have a relatively simple API that sends XHR requests to the server every 15 seconds and triggers events (or callbacks) on receiving data. Other components would be able to “hitch a ride” or get notified about another user’s activities.

In the future this can be used to block simultaneous editing of widgets and menus or any other tasks that require regular updates from the server.

Basically, the admin-ajax.php is used to make AJAX based connections to the server, directly from your web browser. In layman’s terms, this keeps the server side and admin user side in sync. Any changes on the admin side are automatically notified to the server on a periodic basis. Posts get auto saved, login expires after certain amount of time and so on.

Sounds great on paper!

What is the problem with Heartbeat API on shared hosts?

The major issue here is that Heartbeat API is very resource intensive. This does not go well with the fact that resource is the limiting factor on shared hosts.

In fact, every open backend page contributes to communication between server and the browser. Continuous pulse updates are shared between the server and the user, even if the backend is minimized in your browser. This causes unnecessary load on the server. If multiple users are logged in to the backend, this can lead to very high resource usage. Even if a single user keeps multiple pages open, this can lead to a lot of unnecessary resource usage.

What’s the solution? Should you disable it completely?

Not necessarily.

Although it is resource intensive, it contributes to essential functions like auto save feature. Better idea is to use it in a controlled manner so that essential functions are not compromised.

How to control Heartbeat API?

Thankfully, controlling Heartbeat API is very easy. Just download and install this heartbeat control plugin.

heartbeat  API conrol settings

Heartbeat API control settings


  1. Go to Settings > Heartbeat Control.
  2. Use the drop down to set “Control heartbeat locations” to “Allow only on post edit pages”. This disables Heartbeat API everywhere but post edit pages. This keeps the auto save functionality intact without the slowdown effect from other pages.
  3. Next, use the drop own to “override heartbeat frequency” to “60 seconds”. This overrides the default value and sets the Heartbeat API usage frequency to 60 seconds. This ensures that requests are sent to the server only after an interval of 1 minute. This prevents unnecessary frequent requests being sent to the server and thus reduces server usage.

If you want to customize further, you can do that. You can disable Heartbeat API on specific pages or to set the heartbeat interval to a custom value, You need a little knowledge of php though. Here is a detailed guide that teaches how to edit code to disable Heartbeat API on specific pages (in case you really need that level of control).

Also, make sure that you do not keep multiple “post edit pages” open at the same time. If multiple pages are open, each of them would send multiple POST requests. This would put unnecessary pressure on the server and it is best to avoid it.

Your thoughts?

So there you go. I have given you the easiest way to control the heartbeat API and prevent unnecessary load on your server. I hope this would help you with the “connection lost” problem in the post edit pages. It worked for me!

Let me know if this solves the issue for you. If you face any problems or have further suggestions, please feel free to share in the comments sections.

And please give it a share if you found this solution useful. I am banking on you to spread the word.

Get more stuff like this
in your inbox

Subscribe to my email list and get interesting stuff and updates to your email inbox.

Neil is the owner of Blogician. Neil writes on every aspect of Blogging to make life simple for fellow bloggers. Follow Neil to learn how to grow a blog.
2 Responses to “How to resolve the WordPress connection lost issue with heartbeat control plugin”
  1. Brigitte Lepoix May 10, 2015
    • Neil May 10, 2015

Leave a Reply

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

1 HUGE MISTAKE that is PREVENTING your blogging success

Know it, correct it, get successful. Subscribe to GET THE EBOOK.