We try and not be too opinionated with how to do Headless WordPress but we do have a lot of experiencing building these sites so try and offer a hint where we feel it’s needed.
We’re also aware that not all our users are WordPress experts, in fact our core audience is to serve WordPress to non-WordPress developers to give publishers the best platform and developer the freedom.
Custom Fields allow us to create fields for certain content, for example if you were to build a team section (which you could setup as a custom post type using the Custom Post Type UI plugin), you wouldn’t want to add the team members email into Gutenberg core content, you’d want to add this into a custom field.
We recommend 2 ways of doing this:
- Using Advanced Custom Fields plugin, this does as it says, creates custom fields anywhere. Once you’ve set these up we auto-add these fields into the REST Api under acf {}. This allows you simple access to all your fields within one place.
GraphQL users will need to add this free plugin to access ACF data – https://www.wpgraphql.com/acf/ - Another approach would be to use WP Engines Atlas plugin, this would be instead of ACF as we feel you should use either/or. The beauty of this is that you don’t need to use the Custom Post Type UI plugin either, you can create your team post type with custom fields baked right in. More information on this found here – https://twitter.com/kellenmace/status/1427609152331911171?s=21 and to download use https://github.com/wpengine/atlas-content-modeler
We feel these are the 2 best approaches when modelling data within WordPress, you don’t have to use WordPress in its traditional sense using Gutenberg, you can model your data as you see fit.