Well this is slightly different from our standard post – while normally our posts are quite nerdy, here’s one many of our clients might also find useful! (No surprise if you are reading this under direction from our link)

In short there appears to be a minor bug in WordPress – given many people will have been directed here on our request we will do this blog in perhaps the reverse order to what we should, first the solution and then for those still curious the reason this happens. So if you are unable to correctly edit Gutenberg blocks in WordPress 5, which will be demonstrated by the greyed out “Add Block” button (the plus sign in the circle) and a bunch of HTML in the paragraph box (the <!– wp:paragraph –> in our Hello world example gives it away!)

The Solution

Hover your mouse over your name in the top right corner, and select “Edit My Profile”. Here you will see information about your profile.

Find the option that says “Visual Editor -> Disable the visual editor when writing”. By default this is not selected. Tick that box, scroll to the bottom and click “Update Profile”. Here comes the crazy part. Now that you have done that, find the box that says “Visual Editor -> Disable the visual editor when writing”. It should be selected, obviously, because that was what we just told you to do. So go ahead and deselect it. Scroll to the bottom and click “Update Profile”. Right, that’s it! You should not have the normal editing experience back!

Why does that work?

To clarify we are basing this on assumption, but we have noticed this problem only occurs with sites we are upgrading. New sites built with WordPress 5 don’t have this problem, but WordPress 4 sites we move to WordPress 5 do run into this problem! So we looked at the database. The Visual Editor setting updates the usermeta table, adding a meta_key named “rich_editing”. For user accounts made in WordPress 5, this is set to “true”, however for older accounts, this meta_key is missing, and of course within WordPress it defaults to true – probably the reason that the option is worded as “Disable” the visual editor rather than “Enable” the feature. When we deselect it, the database has to ensure the meta key is there and set to false, when we then deselect it, because the meta key is there it has to be set to true. Now the assumption is that while WordPress says if the meta key is missing it defaults to true, Gutenberg is clearly looking specifically for this option to be set to true, and failing that assuming that the visual editor is disabled and therefore it should not enable the Block editor!

Slightly frustrating if you unexpectedly stumble across it, but easy enough to resolve!