WordPress 5.6.1, which numerous websites auto-updated to, has introduced a bug that makes it hard to save a post. A temporary fix has been made to address the issue but it is not an official update to take care of the issue.
A bug brought into the most recent version of WordPress, version 5.6.1 causes an alert to pop up when attempting to navigate away, regardless if the post has been saved or not.
The bug was reported in a WordPress support page:
“I am getting the pop up “Leave Site? Changes you made may not be saved. All the time, if I change a page or not, and if I save (publish or update) the page or not.
This began after the 5.6.1 upgrade this morning. I have 2 sites, with 2 different themes, both with the classic editor 1.6 and it behaves the same on both.
It does this in Chrome, it does not do it in Firefox.”
The fact that it doesn’t occur in Firefox is interesting because, as per Mozilla documentation, Firefox handles certain parts of the unload event uniquely as compared to Chrome in that Chrome lacks certain features.
This isn’t a Chrome issue however. I’m simply pointing out why a bug may appear in Chrome however not in Firefox.
The notice is essential for what’s called an “unload event” that triggers an warning when a publisher attempts to navigate away from a window, typically when something is left undone.
The specific warning message set off is:
“Leave Site? Changes you made may not be saved.”
The bug shows itself in both posts and pages. But some publishers have reported that the bug is possibly present when editing page content and works fine when editing post content.
As indicated by a few reports the bug could be set off by editing related plugins like Tiny MCE and Advanced Custom Fields. Turning off those plugins prevents the dump message from generating.
A publisher reported in the private Advanced WordPress Facebook group that turning off the Advanced Custom Fields plugin stopped the warning from generating.
But the issue isn’t with the plugins themselves. The issue appears to be within the WordPress core itself which is causing the problem to manifest in various editing related windows.
One publisher reported relief by turning on the Gutenberg editing environment:
“Do You Want to Leave This Site? Changes you made may not be saved” Alert notice on leaving updated pages (but not posts) after 5.6.1 update when using classic editor. …Goes away when Gutenberg is turned back on.”
Another publisher noted that WordPress editing related plugins seemed to trigger the bug:
“Update: It looks like the user has to wait for TinyMCE to entirely load before making a change; otherwise the script doesn’t take his change into account.
A good visual hint is the dropshadow of toolbar which dispear once the editor is correctly initialized.”
One user uploaded a video of a walkthrough indicating how the bug is generated. In the video the publisher picks a document to edit and enters the editing window.
The publisher next presses the update button to save the page. They next click a link to navigate away from the editing window.
But the act causes the unload warning message to spawn.
A fix has been posted on WordPress, but it’s not an official fix.
This version of the fix is completely useful. It’s code that should be embedded into the functions.php file.
There is another fix that was shared that tends to an extra issue but it has not been fully tested.
If the issue is thwarting your work flow, there are steps that can be taken. One recommended step could be to ensure that all editing related plugins are completely loaded. Other actions include disabling editing related plugins or turning on Gutenberg.
There is a fix that can be applied to functions.php and finally one can hang tight for an official fix.
We at CodeLedge, offers the Sweden’s best WordPress development services. Our WordPress developers are very professional to develop unique, efficient and light weight websites for every type of business. Email us at firstname.lastname@example.org or get a quote from here.