SOLVED Updating Failed – Error when updating with Gutenberg

As part of my recent investigations in the new Gutenberg editor for WordPress I came across a cheeky little error that had me stumped for a while.

Gutenberg Updating Failed error

Now, I saw this issue whilst running on a local VVV setup, that I’d created solely for this Gutenberg investigations, and as such it was running on an nginx server. I had also not tweaked the default permalinks settings.

Some digging later I pulled out this github issue, and that lead me to the solution workaround here.

Solution

To get it working, all you have to do is set a more fancy permalink structure, such as http://local.wordpress.dev/sample-post/.

Further Info

It seems the issue is to do with PUT request support in the default nginx config, and the way the WordPress REST API works out-of-the-box. If you want more info, follow that trac ticket above.


I hope to be writing more on my Adventures in Gutenberg, especially my work on adding support for it to the Widgets on Pages plugin.

Sinon – Checking if a function has been stubbed

Just a quick post here, in reference to using Sinon.jS, and checking whether or not a function has been stubbed.

Let’s say that you might have stubbed a function like this;

var foo = sinon.stub(jQuery, "ajax");

You can check to see if it’s been stubbed already, with this;

if ( jQuery.ajax.displayName === "ajax" ) { ... }