My previous employer built a custom theme for their in-house web sites from scratch and used a plugin called “Meta Box” to handle the metabox UI for their posts, pages and custom post types. The base plugin is free in the repository and they offer some premium addons and support from their web site at MetaBox.io. They ran a special a while back for a lifetime license and I bought one for myself.
I’ve really only messed with it a little it here and there and not really used it for a “real-world” project. I’ve been an Advanced Custom Fields Pro user for many years and it was always easier to just jump in and start new projects with ACF than to start the learning process of Meta Box. However, a little while back the author of Meta Box contacted me directly to get my feedback on Meta Box. Since I hadn’t really used it beyond playing around here and there, I didn’t really have much feedback for him. But, fortunately, I was just about to start a new web site for a client and it was the perfect opportunity to use Meta Box instead of ACF.
Nearly every web site I build includes a calendar of some kind… usually an event calendar, but sometimes it’s an appointment calendar. Rather than buying an expensive license for Modern Tribe’s Event Calendar for each site, I just build them in ACF. Not only does it save me some $$, but I can customize it for each client/site. This time, I built an appointment calendar for the client in Meta Box.
Installing Meta Box
The process of installing all the necessary MB plugins to the site was a bit annoying, but it appears that will get better soon. You have to installed the free base Meta Box plugin and then install each premium plugin separately. There is an “All In One” installer, but it only works with the free plugins, not the premium plugins. If you use Composer there are some great blog articles on the Meta Box site for installing with Composer, but otherwise, it’s an annoyance to get it installed.
So, just to be clear… In order to use Meta Box, you have to install and activate all the plugins you need for your project before you can install your project. Well, technically you can include() them in your project, but that gets very messy and is very discouraged. This is NOT a seamless product for creating metaboxes in your distributed projects. But then, neither is ACF.
I posted this on their support message board, but I would buy a separate license for a product that can seamlessly be included in a distributed plugin or child/theme. I think this is a major need that’s not being served (or served well).
Meta Box has some plugins for helping you to built Custom Post Types, Custom Taxonomies and a visual meta box builder. I’ll get into those, but I didn’t want to install them on my client’s site, so I only installed the core plugins I needed to access from my custom plugin code. I installed EVERYTHING on my developer sandbox site and used the CPT and Builder tools to auto-generate code for my custom plugin.
Custom Post Types
For most of my client sites, I create my Custom Post Types in code. But, I cheat by using the CPT UI plugin on my “developer site”, copying the auto-generated code from that and then customizing it. CPT UI is a great free plugin for creating CPTs quickly with almost all of the bells and whistles. Oddly, the UI for CPT UI is awful, but it works great.
Meta Box comes with it’s own plugin that essentially does the exact same thing. It’s not as full featured as CPT UI, but it has 99% of what I need and it also generates code I can copy and customize. I like the easy icon picker over CPT UI’s text input (saves me from having to visit the Dashboard Icon web site). One feature I found missing was the ability to specify the the menu item for the CPT should be a submenu of another CPT. I was about to post about it on the support forum when I discovered someone else literally posted it a few hours before me. The support staff answered almost immediately and within a couple of days had a new version out with that feature.
So, for my calendar project, I jumped into the Meta Box Custom Post Type plugin to create my CPTs and them copied the generated code into my plugin project.
Meta Box Builder
One of the things that I absolutely love about Advanced Custom Fields is their visual metabox builder. It’s fairly intuitive, has tons of options and I can build a simple metabox in just a few minutes and VERY complex metabox in less than an hour. I have literally gone into a meeting with a client and built their interface using ACF in that meeting with their feedback. Prototyping is super simple and all that’s left is to write the supporting code to handle custom tasks and display the data on the front end.
Meta Box has a similar plugin that lets you visually design your metabox. And it does almost everything the ACF builder does. It’s not quite as intuitive or easy to use as ACF. But the ACF builder is many years more mature than the Meta Box Builder. Nonetheless, I was able to fairly quickly build out a someone complex metabox form using it. Controlling the layout of a MB form requires a separate premium plugin and it took me a while to figure out how to use it properly, but once I “got it”, I was able to quickly get the form looking 90% the way I wanted to (I am still having issues with the label placement). Once I got things looking the way I wanted, I copied the generated code to my plugin. As a “coder”, I absolutely love this feature. You can somewhat do the same thing with ACF, but involves exporting and importing forms using JSON files that feels “wonky”.
The interface for Meta Box Builder is serviceable, but I found it harder to use than ACF’s interface and it has some weird differences. For example, in ACF when you duplicate a field it creates the newly duplicated field within the context of where you duplicated it. So, if I am duplicating a field inside of a Group, the newly created field is created inside the group. In MBB the new field is always created at the end of the form stack, so if you have a large long list of fields, you have to scroll down to the bottom then drag it back up to the group you are working in. Also in MBB, each field editor has tabs for accessing the different features of the field. In ACF it’s all in the a single editor and easier to find. Essentially a LOT less clicking in ACF when you’re building forms.
What’s interesting is that while both ACF and MBB support READ-ONLY fields, neither has a simple checkbox to enable READ-ONLY, you have to do it in code.
ACF has a huge list of field types you can use in your forms. And Meta Box has almost all of the same fields as ACF and it has some that ACF does not. Both products let you create your own custom fields. ACF has a slight edge in how easy it is to create a custom field. And since it’s been around a lot longer than Meta Box, there are dozens of addon fields for ACF that don’t exist for Meta Box.
For this project, Meta Box had everything I needed, including Repeatable Fields (clones in MB). Again, I’d give a slight edge to ACF for how easy it is to edit the various options for fields in the builder. I added a “SELECT” field in MBB and I had to click an “Add Option” button for each option I added to the field, while in ACF it was just a massive textarea. This makes it so easy to cut and paste between fields. Also, the “TIME” picker field in MBB is a lot clunkier than the one in ACF to use. I’m not a fan. This is where I’ll probably create my own timepicker field for Meta Box rather than use the built-in one. What I don’t know is if the Meta Box Builder will see my custom field or not… In ACF the builder sees all registered fields.
Custom Plugin Code
Both ACF and MB support front end forms, so I was able to build a form for my client’s customers to fill out and request an appointment. And I was able to copy my ACF code for displaying the calendar and appointments into my custom plugin and easily use Meta Box instead of ACF for pulling data to display. This is truly where Meta Box beats ACF hands down. ACF is very inefficient in data storage, writing at least two records for every field in your form. This can bloat your POSTMETA database table pretty fast and with a HUGE table, it can cause performance issues. Meta Box only writes the form data to the POSTMETA database. And in the case of complex groups and repeaters, it serializes the data and writes it all in a single entry making it SO MUCH more efficient and easier to access. There’s a very expensive (but very good) third-party plugin for ACF that can store your form data in a custom table that I use for a couple of HUGE databases I built with ACF. Meta Box has a very affordable premium plugin that does the same thing.
Once place where ACF does beat Meta Box is in filters and action hooks. ACF has a lot more and you can more easily target a specific field with a filter or hook. But everything I did with ACF for my calendar I was able to do in Meta Box, so they are there, just not as easy to use in some cases. And the documentation for ACF is also a bit more mature. It took me a while to figure out how a number of things worked in Meta Box… usually by searching the support form where I generally found the answer.
I love ACF and I’ve spoken at quite a few WordCamps about it. It’s easy to use. It’s quick to build out a project. It has a massive support community. And it’s well know enough that I don’t get many (if any) questions about using it in a production environment. But I can see myself making the switch to Meta Box for most of my projects. It’s well written, well supported and for an old “coder” like me, it’s so much easier to write code for. There are still some issues that would prevent me from completely switching, most notably the ACF builder is a bit easier to use and more mature. I feel comfortable enough with it to bring it up on the screen in a meeting and make quick interface chances for a client and let them see immediate results.
If you are a new to intermediate user of ACF and not so much a coder like me, stick with ACF. It was built for ease of use. But if you are a hard-core coder and you’re building big database projects in ACF, the advantages of Meta Box should not be ignored and you should give it a try.
What I would REALLY REALLY love to see from Meta Box is a separate product that does not install as a plugin. Something I can easily include in my projects and that I can use some kind of tool to build out an include file that only includes the fields and features I need for that project.