How to Fix “Updating Failed” error in Gutenberg after wordpress upgrade

How to Fix “Updating Failed” error in Gutenberg after wordpress upgrade

Gutenberg is the latest editor which is being rolled out with the wordpress 5 as default option. Some users who are using reverse proxies or cloudflare for security reasons are facing issue where they are not able to update the posts. The error which is returned by wordpress on screen is “Updating Failed”.

Wordpress 5.0 Updating failed error in Gutenberg

 

We have diagnosed this error for some of our clients and fixed this issue. Here we will explain what causes this problem and how to fix this.

This problem occurs because of issues in the cookies validity and cross origin requests. there can be many reasons to this but for us we were using varnish cache and were stripping the cookies for all requests except for wp-admin and wp-login; We added wp-json in exception list and it fixed the error.

if (req.url !~ "^/wp-(login|admin|json)") {
unset req.http.cookie;
}

 

As in our case requests with wp-json were being cached, wordpress was sending following error with forbidden 403 error code.

{"code":"rest_cookie_invalid_nonce","message":"Cookie nonce is invalid","data":{"status":403}}

 

In your case it could be same error or it could be because of cross origin; probably wordpress might be sending requests on tld with www or without www which does not have active cookie; or it could be related to the ssl where if wordpress is configured using https it might be sending ajax requests to website on http;  If you are using cloudflare and using flexible ssl, you should change it to full ssl and install ssl on your origin server.

Leave a Reply

Your email address will not be published.