Custom fields

Meta Box

Documentation
Go to Meta Box
MetaBox banner
20th May, 2018

Meta Box
By MetaBox.io

Meta Box is another Custom Fields plugin for WordPress. Though it is as popular as Carbon Fields and ACF, it has over 300,000 downloads on wordpress.org. Let’s see how it stacks against the competition.

Before starting keep in mind that WordPress uses the term ‘meta box’ to describe the boxes inside the admin area. This could be anything such as eg: the category selector, the featured image selector,comments section, etc. Meta Box literally creates ‘metaboxes’ – hence the name.

Functionality chevron-down

You can install Meta Box from the wordpress.org plugins repository or you can load it via composer. After installation you’ll be shown an introduction page. Other than this page, there’s no admin/settings/options page for Meta Box at all. You’ll need to setup the fields manually inside your functions.php file. Here’s how the API for that looks like:


add_filter( 'rwmb_meta_boxes', 'prefix_meta_boxes' );
function prefix_meta_boxes( $meta_boxes ) {
  $meta_boxes[] = array(
    'title' => 'Test Meta Box',
    'post_types' => array( 'page' ),
    'fields' => array(
      array(
        'id' => 'name',
        'name' => 'Name',
        'type' => 'text',
       )
    ),
  );
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'your_prefix_get_meta_box' );

The API is straightforward. You’ll need a function where you can define the fields as an array. For those who’ve used Carbon Fields, this is pretty similar. It may look a lot of work in the beginning but its pretty simple once you get the hang of it.

There’s also an online form generator which can help you greatly speed up field group creations. This is super useful as coding large field groups can be tedious.

Once you’ve added the code above in your functions.php, create a new page and you should be able to see a textbox metabox underneath the wysiwyg field.

To grab the data entered here, add this in your template:

echo rwmb_meta(<field_id>);

That’s how you can get and set data via MetaBox. You can also show data via shortcodes which can be pretty useful.


The core MetaBox plugin comes with over 40 plugins. That’s quite a lot and even more than most Custom Field plugins.

Some of the fields are:

  • Text
  • WYSIWYG
  • Image
  • Image select
  • Button
  • Custom HTML
  • Select Advanced
  • File input
  • Map
  • OEmbed
  • Date Time
  • Post
  • Taxonomy
  • User

Out of these, we really like the button and the HTML field. The button allows you to bind it to custom actions via their API. There are many thing you can do with this, eg; you can have a button field on the post page which submits the post to twitter/facebook/ifttt, etc when clicked. Or you can trigger a spellchecker/wordcounter function on the edit page which parses all the metaboxes in the post page.

The HTML field allows you to write markup. So you can possibly add instructions for content writers inside the markup and style it a bit. Or when you’re including MetaBox inside a plugin, you can show notifications via the HTML field.

One glaring omission is the repeater field which can create repeatable field groups. There’s options to set a clone option to fields where you can retrieve values as an array but if you need a full blown repeater field, its available as a paid extension.


By default you can only attach field groups to posts and pages. There’s no option to attach them to taxonomies, users or even custom post types by default. The only way to do this is to install extensions.

The philosophy of MetaBox is to keep the core plugin lightweight. Any extra functionality you need, you can install it as an extension.

Styling metaboxes

There are options to show fields in a column but for more advanced styling you’ll need to enqueue an admin css file to apply your changes.

API chevron-down

The API exposed by Meta Box is very straightforward. To get a field on the Frontend, use rwmb_meta($name, ).


With the API provided you can also create your own field type in case 40 field types aren’t enough.

All field data is stored in the postmeta table. This means that you can use the default get_*_meta functions to retrieve data. You can also bundle Meta Box with a plugin too.


The documentation has a detailed filters page where each filter is explained. There are some standard actions provided which hook into the before and after creation of the metabox itself. There’s also rwmb_after_save_field which can be used to modify values before saving in the database. There also an rwmb_enqueue_scripts via which you can style the metaboxes.

Documentation chevron-down

The documentation is neatly organized. Code examples are given whenever appropriate and all field options are mentioned. The only thing lacking are advanced guides on topics such as customizing the look and feel of the metaboxes, retrieving and manipulating data via actions and filters, etc.

Other than the documentation, there are hardly any tutorials, guides, etc on other websites. Honestly, the name is so generic that its really hard to find anything related to Meta Box on Google.

Gotchas chevron-down

Meta Box by itself it very lightweight but you’ll need to install extensions in most situations. Also, Gutenberg is supported but some fields may not work correctly.

Other than that, its pretty straightforward.

Support chevron-down

Meta Box has their own premium forums for support but only paid users can post queries. Other people can use github issues to log bugs or use stackoverflow.

One thing we found in our research is that the name Meta Box can mean so many different things on Google its very heard to search for specific issues. On top of that, the overall search volume for this term is extremely low meaning its really hard to get answers via Google search for Meta Box specific issues.

The author does recommend adding ‘Meta Box wordpress’ before the search query when you’re searching for tutorials, guides, etc.

Pricing chevron-down

The core Meta Box plugin is free and open source. There are paid versions available which add premium addons, yearly support, etc.

Core Bundle Developer Bundle Lifetime Bundle
$79 $149 $349

These bundles come with varying numbers of paid extensions however you can separately purchase extensions from here. There are also heaps of free extensions available too.

The plugin is free but you’ll most likely end up shelling out a couple of bucks for extensions. You can always get the developer bundle which comes with the clone field as well as a few other useful fields.

TLDR chevron-down

Meta Box does everything other Custom Field plugins do already. Its pretty barebones from the start but you’ll definitely need to install extensions to get things done with Meta Box. Don’t be fooled by its small footprint though, you’ll definitely need to install a few Meta-box extensions to get the most use out of it.

It comes with 40 extensions but funnily, doesn’t come with the most important one – the clone field(also known as a repeater field).

Other than that, documentation is solid and development is active on Github although its really hard to search for specific topics on Google as the plugin’s name is horribly generic.

Technical Report chevron-down

Lines of code 6,426
Cyclometric complexity(CC) 4.44
Code violations

(0 criticals, 13 errors) - 23 violations

Uses custom Db table? No
CC Chart

The Cyclomatic complexity is under the baseline compared to most plugins. This indicates that coding standards are fairly good for Metabox. Keep in mind that Metabox doesn’t come with batteries included – you’ll most likely need to install a couple of extensions which can definitely increase the footprint of this plugin.

Data generated from Phpmetrics. Although the data found through our research has been produced and processed from sources believed to be reliable, no warranty, expressed or implied, is made regarding accuracy, adequacy, legality or reliability of any information.

Features

Drag and drop builder Partially - available on an external site.
API Yes - Comprehensive.
Conditional logic No - but there's an extension to enable conditional logic.
Gutenberg ready Yes - but some fields may have issues working correctly.
Multisite ready Yes
WPML compatible Yes
Custom Post Type compatible No - but there's a free extension to enable custom post type support.
WP REST API compatible Yes - via a free extension

Verdict

A bit light on functionality out of the box – but the available extensions more than make up for it. Definitely keep an eye out for it.

  • Easy to use. Documentation is concise

  • Doesn't come with much functionality. Need to install extensions to make it useful.

  • Finding tutorials for Meta Box online can be hard.

4/5

star-full star-full star-full star-full star-empty

Helpful disclosure

Our works are supported by earning an affiliate commision
when readers choose to purchase a plugin based our reviews.

2 responses to “Meta Box

  1. I’ve noticed the “hard to search on google” too. Actually seems impossible to find things related to metabox on google. The naming is just wrong and overused.

    Aside from that I am spending a lot of hours to evalutate it because it seems a really good solution

Leave a Reply

Your email address will not be published. Required fields are marked *