About WordPress “The connection is lost. Saving has been disabled until you reconnect.”

About WordPress “The connection is lost.

When editing an article recently, an error message often appears: the connection is lost. Saving has been disabled until you reconnect. As long as it is only a problem that occurs when editing an article, it is generally not a major mistake and you don’t have to panic. But since it affects the editing experience, the problem still has to be solved. There are many solutions on the network, but all of them are not effective.

Several solutions have been used recently, which may help you cure symptoms or cure the symptoms. Please confirm that no other operations have been performed, such as editing the theme code, and then try the following methods. In addition, check whether the Internet is disconnected…

Stock Market Trading Hours Black Friday : Thanksgiving Day Stock Market Trading

Method 1: Disable the auto-save function (fix the root cause) WordPress has an auto-save function, and a draft is automatically saved every 2 minutes. This is undoubtedly a good feature, but automatic saving will cause frequent access to the database and increase server pressure, especially for small servers. In the middle of article editing, especially when the content of the article is large, this problem is basically due to this reason. The solution is to increase the frequency of automatic saving of the article, or directly disable it (personally recommended to disable, rarely write articles directly in WordPress…). Disable method:

The connection is lost

Edit

Template functions (functions.php)

Method 1: Disable the automatic saving function (a cure)

WordPress has an auto-save feature, which automatically saves a draft every 2 minutes. This is undoubtedly a good feature, but automatic saving will cause frequent access to the database and increase server pressure, especially for small servers. In the middle of article editing, especially when the content of the article is large, this problem is basically due to this reason. The solution is to increase the frequency of automatic saving of the article, or directly disable it (personally recommended to disable, rarely write articles directly in WordPress…)

In addition, it is also recommended that you turn off the revision function in WordPress. Unless you use this as a website such as Wiki, there is almost no need to retain the historical version. For a pure blog, it is even more unnecessary. Instead of periodically cleaning with a database cleaning plug-in, it is better to turn it off directly:

Disable method: Insert the following code in functions.php:

//The following is my own addition. It can be deleted when there is a problem with the program
 //Disable automatic saving
add_action('wp_print_scripts','disable_autosave');
function disable_autosave(){
	wp_deregister_script('autosave');
}
 //Turn off the revision function in WordPress 
add_filter( 'wp_revisions_to_keep', 'specs_wp_revisions_to_keep', 10, 2 );
function specs_wp_revisions_to_keep( $num, $post )
{ 
	return 0;
}

Save it when finished, just try to edit the article.

Of course, if you are buying a medium- or large-sized server and this kind of problem still occurs, please check the firewall logs. If there is a record denying database access, please contact the server provider to set up a whitelist.

Method 2: Restart the server (surgery)

It is also due to frequent access to and modification of the database due to revision of articles, uploading pictures, reading tags, etc., which leads to the loss of connection. Even 500 errors, you can restart the server. Before that, you can edit the text of the article (the upload picture function is not available, if you use the picture bed, there is no problem), switch to the text editing mode, copy the article code to the local txt file. Then restart the server. After the restart is complete, paste the code and revise the label, classification and other attributes to publish. The code copied from the text editing mode can also be imported into WordPress through the import function by creating an XML file. For details, please refer to the introduction in WordPress Tools → Import and Tools → Export Options (export a replacement content and then import).

Method 3: Plug-in inspection (root cure)

Some plug-ins and synchronization plug-ins that access third-party servers can cause this problem. List of plugins found so far:

WP-Sina login plugin

Baidu Sitemap plugin

WPJAM

WP-QINIU

This problem may also occur with other third-party sync/map bed services. The solution is as follows: Log in to the FTP page, open the /wp-content directory, and rename the plugins folder to plugin. Log in to WordPress and check, if there is no problem, remove the plug-ins that may access the external network or involve caching in the plugin, and rename them back to plugins. Move back to the above plugins one by one to test the problem. Please ensure that the plug-in is the latest version or a stable version. If there are plug-ins related to the appearance of the website (such as Aksmet and CSS plug-ins), please restore them first to prevent the appearance of the website from changing. A

Method 4: Directly check 500 errors (fix the root cause)

After the above problem occurs, the host will generally enter a 10-30 minute pseudo-dead state. During this period, the access will return a 500 error (if it is other errors, such as 504 error, please check the network problem and server operation status). Using this 500 error, you can dig deeper into the cause of website paralysis. Log in to the FTP page, download wp-config.php in the root directory to the local and open to replace define(‘WP_DEBUG’, false); define(‘WP_DEBUG’, true); add ini_set(‘display_errors’,’Off’) ; Save and replace wp-config.php in FTP. Visit the website and observe the return value. If Error establishing a database connection appears, it means that the database is down. Restart the database to solve it. If it is another value, you can search for the cause of the error yourself. After solving the problem, restore the wp-config.php file

Method 5: Check the server status / upgrade the server (fix the root cause)

The server status can cause the article to be saved incorrectly, or 500 errors. Please enter the host management interface to view the status of the host. The main checks include: the margin of web space and database space; the occupancy of the CPU and memory of the host; the traffic margin of the host. To be honest, changing a good host can solve many problems (…). The webmaster has used Western Digital, Meituan Cloud, Alibaba Cloud and other hosts, the latter two are much more stable than the former. In the worst case of the former, you can receive nearly 10 exception notifications (alarms from the cloud monitoring service) a day.

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*