Updating Or Publishing Failed
Recently I was creating a new post, and I suddenly started getting the following error.
Updating failed. The response is not a valid JSON response.Error on updating a page
After that, the server seemed to time-out.
Disable Gutenberg Block Editor
When I researched the problem online, I found it was quite common. Lots of people have reported this error. Some people suggested going back to the Classic Editor. I didn't want to do that as it's only a workaround, not a solution.
Is It Permalinks?
Some people were saying it was a permalink problem, and all you had to do was re-save your permalinks. While this was a solution for some, I tried changing my permalinks and in my case it made no difference. The problem persisted.
Some other people were saying that saving permalinks wasn't enough, and that you had to check permalink settings in your .htaccess file. But I'm hosted on nginx and don't have an .htaccess file.
I contacted my host - GridPane - and they said my nginx files were set up properly already and there was nothing I could add to make permalinks processing any better.
They suggested I checked the nginx error log and then if there was nothing in that, I should disable all my plugins and re-enable them one at a time to see who the culprit was.
Is It A Plugin?
So I disabled all the plugins installed on my site, and used a free WP theme. I tested that I could update the page - and I could. I then re-enabled all one at a time. I didn't believe it would be a plugin problem but I had to check.
It turns out it was the Gravity Forms plugin that caused the issue for me, or possibly some combination of Gravity Forms with another plugin. Who knows. While it is was definitely my problem, it's not my job to debug other people's code unless I have no choice but to do so.
The fact was that if I disabled Gravity Forms the problem went away. As soon as the Gravity Forms was re-enabled the problem came back. The version I was using I believed was the latest at the time : 2.4.19.
If like me, you've tried the permalink approach but it changed nothing, and your host is already set up properly so nothing to be gained there, then you too might have a plugin problem.
The plugin causing your error might not be Gravity Forms - it could be any plugin. The only way to find out is to use a harmless theme, disable all your plugins and add them back in, one at time until the problem re-emerges.
I reported the problem to the Gravity Forms developers in case they needed to know.
Gravity Forms Support Update
I wrote to Gravity Forms to ask if this was a known problem with version 2.4.19 and if they had a fix. But in the meantime I discovered 2.4.19 wasn't the latest version. The latest version was actually 188.8.131.52. But for some reason it didn't get automatically notified as an update on my site, despite my having a valid developer license.
Gravity Forms support wrote back and said the error was not caused by their plugin and no, they had not specifically coded a solution for this issue in any update.
All that mattered to me in this instance was that the problem went away, and deactivating and reactivating plugins enabled me to find my own solution spo I could carry on working. But if you want actual help from any support team it is best to provide a reproducible problem on a test site they can log into, that categorically shows their plugin to be at fault. If not you will of course get the "not our problem" response. LOL.