Custom Fields and Post Types Future with Gutenberg

One of the biggest pieces of controversy in the early stages of Gutenberg development was around how custom meta fields would work. Many developers installed the development version of the Gutenberg plugin only to find that their custom fields were not showing up. This is something that sparked ticket’s and conversations on GitHub. Some developers (including myself) was worried about the future of WordPress if it didn’t have custom fields. Some were saying custom fields wouldn’t be needed. Now that Gutenberg has officially been in WordPress core for a few months and I’ve gotten a few builds under my belt with it, my thinking on custom post types and custom fields are starting to change.

The Common Way

So by default WordPress has five post types:

  • Post
  • Page
  • Attachment
  • Revision
  • Navigation menu

The most common post types you will typically work with are posts and pages. If your site is something like a book blog, you might have a Books post type with some custom fields for things like when the book was published, who the author is, who the publisher is, where you can buy the book and so on. These custom fields help to structure you data in a consistent fashion on your website.

Custom fields and meta though aren’t always used for visual content components, some themes and plugins use them for layout options, SEO meta, and many other things that you can think of. Custom fields I believe (for now) will always have a part in WordPress, but I believe that over time we are going to be seeing and using them less and less in favor of custom Gutenberg blocks.

Yoast Screen Shot
Yoast Meta Fields

The Gutenberg Way

With Gutenberg instead of having a list of fields beneath the editor, you now can have a block within the editor. This allows to an extent to visually see where your information will be placed within the content. Depending on your sites set up could then move the elements around if desired vs the typical rigid structure of custom fields.

Gutenberg Book Template
Gutenberg book template

Gutenberg Templates

If your theme or plugin uses Gutenberg templates you can start a new post with a preset group of blocks, ready to put in your data, just like custom fields. With Gutenberg templates you have the option to allow the template to be edited on the post with blocks moved around or added, or you can choose to lock in the template structure, which allows blocks to behave even more like custom fields, while still getting that visual look. Setting up a post type in this fashion removes the need for just about all custom meta fields.

Template Improvements

As of right now a Gutenberg template is slightly limited in how it can be used. You can create a template and then assign that template to a post type. From the point a template is created all new posts within that post type will start with that template. It’s a great feature, what would make it even better is if a template could also be saved as a block, or block group. If this was to happen instead of having a books post type, you could have a full books page template that could be loaded up on any new page created, removing the need for the post type all together. Technically if you made a massive block you could do this now. There are a few plugins that manage this now as well, however the future is bright for Gutenberg.

Gutenberg Future

Grouping blocks into a template is a feature that would have a massive positive impact on how we edit pages, and it’s in development now. Once this feature is in place you may see post types reduce even further.

Gutenberg is changing WordPress and how we build sites. For developers this introduces new challenges, for users this introduces a better editing experience. As a developer I’m feeling some of the challenges, I’m questioning the best method to build things. Gutenberg continues to have new features added to it, and we are only in phase 1 of it’s release, with 3 being planned. Some may disagree but all new builds even with the future in mind should start with Gutenberg, if not you’re already setting your site up behind the eight ball, Gutenberg is here, it’s not going away, and it’s awesome. That’s not say that Gutenberg doesn’t have room for improvement, but like any other feature in WordPress it will just get better with time.