This article is not sponsored by any of the mentioned plugins/companies and contains no affiliate links.
For developers, using custom meta boxes (also known as custom fields) is very common. Metadata allows you to store custom data outside of the post / taxonomy / user content. Examples of why you might want to use metadata:
- You are reviewing products and want to score store the review score. Storing this separately allows you to easily display it in other areas of the website and even sort by it.
- You want to make a DIY page builder for a specific page template; this is great for client sites as you can collect small pieces of data and extract it in to a well-designed template.
- You would like to store more user data such as a field for hobbies and interest.
Really, the reasons are countless – if a post needs some extra data, then you’re probably going to use a custom field to achieve this.
In WordPress, there are a few types of metadata such as taxonomy meta, post meta and user meta. This means that the data belongs to a specific taxonomy, post or user. For data that doesn’t need to be assigned to a specific taxonomy/post/user then the WordPress options table can be used for things such as global site settings.
Gutenberg is changing this slightly, but there’s certainly still a real need to abstract data out of a post and in to its own piece of meta. You can do this using standard WordPress functions, and in simple use cases this may be appropriate. However, if you want anything more advanced then you are likely better off leaning on one of the popular meta box plugins or libraries. These libraries give you an easy way to add some standard fields to meta boxes, such as:
but there’s also some more advanced fields available. We’re going to summarise some of the most popular.
Advanced Custom Fields
If you haven’t heard of ACF then you probably should have. It’s extremely popular and in constant development. It has both a paid and free version with the main difference being the number of fields available to you. There are all of the usual basic fields available in the free version.
The pro version comes with the flexible content and repeater fields (amongst some others).
- Flexible content allows you to effectively make your own page builder. You create set groups of fields and program your templates for each group. The user can then add groups of fields in the WordPress admin – as many as they like and change their order. Very useful.
- The repeater field allows you to have repeating data, let’s say you were creating a gallery and wanted to accept anywhere between one and ten images as inputs. Instead of having to create ten fields, you can make a single repeatable field.
- Gutenberg block API – whilst not strictly post meta, ACF does allow you to create Gutenberg blocks suing a PHP API.
ACF is very well documented and comes with its own basic functions that follow normal WordPress conventions. This makes it extremely easy to pick up. Unlike many other meta box plugins, in ACF you create fields visually through the WordPress admin. This has both advantages and disadvantages. On one hand, it’s super quick to make fields in this visual way, but on the other hand it can be harder to maintain fields across multiple installs and environments. Fields can be registered (and exported) to PHP, but if you do this you can’t then edit them using the visual editor (without the help of third-party plugins such as ACF Extended). This has been improved, though fairly recently with the addition of local JSON.
The Pro version recently changed pricing model. It was arguably too cheap before; it’s still affordable but is a yearly subscription. At time of writing, pricing is:
- 1 website – $49 per year
- 10 websites – $149 per year
- Unlimited Websites – $249 per year
We think this pricing is fair and represents excellent value for the time saved.
Metabox.io is another popular plugin that allows you to easily create a vast amount of custom fields. Like ACF, it has both a free and paid version where the fundamental difference is the amount of field types you have available.
One of the paid-for extensions is the all-important repeatable field. Unlike ACF, it doesn’t feature direct replacement for the powerful flexible content field. Something similar is achievable though, albeit the implementation isn’t as elegant.
The biggest different between ACF and mb.io is that mb.io is more geared towards developers. By default, there’s no graphical user interface for creating fields. Instead, you register them using code. For many, this is a big plus. It allows to you move common field groups you’ve used in the past and insert them in to new projects. It has extensive supporting documentation for this, as well as an online code generator and an addon for visual creation.
Just like ACF, mb.io also has a PHP API for creating Gutenberg blocks, but this is only available as an extension on the “developer” plan or as a standalone extension.
We find the pricing model of mb.io a little less simple than we’d like. Their paid plans are all for unlimited sites, but the different plans cover how many ‘extensions’ are included. This can be a little confusing as you aren’t always sure what features you might need before purchasing a plugin, they do allow you to upgrade your package at any time though and do offer a lifetime package.
The pricing at the time of writing is as follows:
- Core (includes 12 extensions, unlimited sites) – $99 per year
- Developer (includes all extensions, unlimited sites) – $199 per year
- Lifetime (all pro extensions, unlimited sites) – $499 lifetime
All of the packages have had a price hike fairly recently, but it’s still good value (especially the lifetime as it includes support) coming in a little bit cheaper overall than ACF
Carbon Fields is the first fully free plugin in our roundup, but don’t let that full you – it has features to rival the paid alternatives.
Similar to Metabox.io, Carbon Fields is aimed at developers. There’s no visual builder, instead you create your fields using code. Notably, Carbon Fields has a really nice, simple syntax along with excellent developer documentation.
It stands out slightly from the competition by not being a traditional WordPress plugin. Instead, Carbon Fields is typically used as a composer dependency (the de facto standard for package management in PHP). This is great for developers as it allows them to include custom fields in their theme or plugin without the need for the user to download an extra plugins. The downside of this is that the update path is not the standard WordPress way either (as it’s not a plugin) – as a user, you’re relying on the developer to keep the library up to date.
As mentioned above, free doesn’t mean that it compromises on features. It has repeater fields (called complex fields) this can even be used to make something similar (although not quite as nice) as ACF’s flexible content field. In version 3, you can now also create Gutenberg blocks – it’s not quite as simple as ACF’s implementation but it is powerful and full featured.
Overall, Carbon Fields is an excellent library and if you are in the position where you cannot afford ACF or you want to bundles fields neatly within a plugin or theme, it may be the stand-out choice.
Other Notable Mentions
There are almost as many custom field plugins as there are form plugins. We think we’ve picked out the three best, but there are some other notable mentions:
Wrapping It Up
Overall, our favourite is ACF. It’s being constantly developed and is often the first to bring new and exciting fields types to the market (such as the repeater and flexible content). The new Gutenberg block functions are starting to get much more advanced, which makes it simple to make functional yet powerful blocks without having to learn a bunch of new technologies (such as React).
What do you think? have we missed anything? let us know in the comments.