Gutenberg Broke My Metabox

I am trying to love Gutenberg (the new WordPress editor). In theory, I think it is something that is badly needed by WordPress and something that will make content editing easier for the millions of people who use it — eventually. In practice, it feels incomplete and I am finding it frustrating to use. To be fair, I also found the classic editor (TinyMCE) to be frustrating, and sometimes end up using the text/html editor to write even simple content.

The other day, Sharon and I were rebuilding the AWN website, and noticed that a custom metabox that we use for entering article authors was missing.

Luckily, it was easy to figure out that the missing metabox was caused by the update to Gutenberg and not by the site redesign because all of the metaboxes on custom content types that are not using Gutenberg were working, and they were added by the same plugin that handles all of the custom content functions for the site.

The problem was caused by Gutenberg not being compatible with metaboxes that rely on selectors that target the post title, and the author field was below the post title field. I moved the author field below the post editor to fix the issue, but not without grumbling a little bit about having to place it there instead of where it makes more sense, below the article title in the same place that it appears on the article.

Common Compatibility Issues

Most PHP meta boxes should continue to work in Gutenberg, but some meta boxes that include advanced functionality could break. Here are some common reasons why meta boxes might not work as expected in Gutenberg:

  • Plugins relying on selectors that target the post title, post content fields, and other metaboxes (of the old editor).
  • Plugins relying on TinyMCE’s API because there’s no longer a single TinyMCE instance to talk to in Gutenberg.
  • Plugins making updates to their DOM on “submit” or on “save”.

Gutenberg HandbookCommon Compatibility Issues

Thank you to the authors of the Gutenberg Handbook for helping me to troubleshoot the issue so quickly!

2 thoughts on “Gutenberg Broke My Metabox”

  1. From a user point of view, I like Gutenberg. As someone who tinkers with his own custom plugins, I loathe Gutenberg. I know it is a good thing in theory but it has complicated some of my projects no end.

    Reply
    • Yeah, definitely not ready for prime time, but at least it keep getting better. It does tend to wreak havoc with older custom plugins that have a lot of JavaScript and/or meta boxes.

      Reply

Leave a Comment