Fixed: Connection lost. Saving has been disabled [WordPress]

Share on facebook
Share on google
Share on twitter
Share on linkedin

Are you seeing this error on your WordPress site while creating a new page or even writing a new post:

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

This might scare you somehow — seeing all the hard work you’ve put into creating the page or post could be gone in an instant.

Fortunately, it’s really nothing to worry about (as long as you don’t close the browser or tab). I’ll explain some fixes you can do to solve the problem.

Step #1: Create a manual backup of the page or post

The problem happens due to one of the three things:

  1. Your internet connection
  2. Your computer
  3. WordPress and hosting

Whatever the case is, follow the instructions I write below so you can avoid any potential loss of hard work:

  • Don’t close the tab or the browser.
  • Don’t reset the tab or visit another page within the same tab.

Although the error stated “we’re backing up up this post in your browser”, it’s important that you create a manual backup of the page as well:

  • If you have Microsoft Word, copy the post into the document.
  • If you have another website that you manage, copy the content into an empty post or page and save it as a draft.

The reason for this is that anything can happen while you attempt to solve the problem. It’s better if you have your own backup so you can simply copy-and-paste it once the problem is solved.

Step #2: Try out different simple solutions

Since we can’t isolate the source of the problem, then what I recommend is you go through different simple solutions first. Each one can be done in only a few seconds.

Here they are:

  1. Check that you’re connected to the internet. Well, if you’re reading this right after the problem occured, then this isn’t likely the fix. It’s good to mention though that loss of connection can trigger the “connection lost” error.
  2. Disable the cache plugin in your website. If this solves the problem, then you may have to enable the “admin cache” or disable the “object cache” feature (or its equivalent).
  3. Increase the memory limit of your website. This is a little technical since it involves using your cPanel or an FTP tool to make the changes.

Basically, to increase the memory limit of your website, you need to access the wp-config.php file and add the following snippet to the code:

define( ‘WP_MEMORY_LIMIT’, ‘256M’ );

If you don’t have access to a cPanel, then download FileZilla first. Once you have it, connect to your site, download the wp-config.php file, make the changes, and upload it back to the server.

Note: If you’re not sure how to do this, try asking your server admin or your web hosting provider to do this for you. That would be way safer.

Step #3: Increase the “No Files Limit” parameter

It’s possible that the “connection lost” problem occurred due to the hosting provider’s ModSec rules (a set of generic attack detection rules).

The error may look something like this under the hood:

[Wed Mar 23 23:23:22.951510 2022] [:error] [pid 11088:tid 47032483968768] [client 127.0.0.1:0] [client 127.0.0.1] ModSecurity: Request body no files data length is larger than the configured limit (1048576). [hostname "example.org"] [uri "/wp-admin/admin-ajax.php"] [unique_id "Yjur6kjDCAZNw7gP7bOZQAAAABA"], referer: https://example.org/wp-admin/post.php?post=666&action=edit&classic-editor

If the error occurred when you tried to save a large page or a lengthy post (especially one with lots of media in it), then it’s likely that this is the reason.

You can see from the error above that the error triggered because the data length is larger than what’s currently configured (1048576).

To fix this, you need to increase the “No Files Limit” parameter on the cPanel by editing the modsec2.user.conf file, which you can find in this location:

/etc/apache2/conf.d/modsec/modsec2.user.conf

For example, the value could be doubled to the following:

SecResponseBodyLimit 546870912
SecRequestBodyNoFilesLimit 20971520
SecRequestBodyLimit 1047483647

Unfortunately, if this is giving you a hard time, you should contact your hosting provider and ask them to change the parameter for you (especially true if you don’t have access to a cPanel).

This last part should solve the issue for you if the error happened while you’re editing or creating a large page or a lengthy post with lots of media in it.

Anyway, let us know in the comments which fix worked for you or if you found an alternative fix that worked with the connection lost problem.

Leave a Comment

Your email address will not be published.