Ola
Ebbesson

ola(at)olaebbesson.se

With the 5.0 update of WordPress and the new Gutenberg editor parts of functionality of Advanced Custom Fields plugin broke down. When creating a new Field Group you get to set the option for Priority. As of the new Gutenberg editor the layout and structure of the editor page has changed. Resulting in one of those options - High (after title), have stopped working as expected.

Instead of displaying after the title the Field Group is now shown at the bottom with the rest of the Field Groups with Normal priority. Not being able to have fields displayed right after the title is a pain in the ass as it breaks the flow when creating and updating pages. And makes it more difficult for users to understand what data goes where.

The problem is noted in this blog post by the creators of the plugin.

"Due to major changes in the WordPress 5.0 edit view, the “high” position is no longer working. Field groups assigned to this position will not show in Gutenberg and we recommend changing these from “high” to “normal”."

"We will look at solutions for this, but are unsure if it will be possible."

So I set out to fix it on my own and here is the quick and ugly fix. It works but the styling and positioning needs some work. I do not recommend anyone to use this in production unless you really understand what you are doing and have a way of retrieving field data that has mysteriously disappeared. This is “tested” with the latest release of Advanced Custom Fields version 5.7.13 but I make no guarantees what so ever that it’ll work with any other versions – or this version for that matter.

In advanced-custom-fields-pro\includes\forms\form-gutenberg.php starting on line 88 and ending on line 94 remove the code ad insert the code below.

Here is a link to a gist of the code for easier copying.

Code is hidden on mobile use link below.

Code on JSFiddle

[ « Prev ]

Archive

OE

ola(at)olaebbesson.se