CMB2 WordPress Plugin: What is it good for? Absolutely everything!

  • What happened to Custom Metaboxes and Fields for WordPress?
  • Is this an actual plugin?
  • Do I need to use CMB2 instead?

These are a few of the types of questions I get asked when talking about CMB2. I agree–it IS confusing! With this post, I’m hoping to shed some light on these questions, as well as properly introduce you to CMB2, and officially announce its release from beta! In short, CMB2 is a metabox, custom fields, and forms library for WordPress much like its predecessor, Custom Metaboxes and Fields for WordPress (affectionately known as CMB), but with some new bells and whistles and a new name.

The story goes…after having been burned by some issues with other custom field plugins, we determined it was best to stick with code that we had some control over. We fell in love with CMB because it was a library we could include in any of our projects and it would just work while letting us keep all of the field configuration in the code, and more importantly, in our version control system.

Quickly CMB became a large part of our process and projects at WebDevStudios, and we were actively maintaining it. We took over the CMB github repo from Jared Atchison in December of 2013. In fact, my very last post on this blog was about that event and the release of CMB 1.0.0.

CMB was (and still is) an incredible library, but it had some glaring shortcomings. The biggest issue we were beginning to bump against was the fact that only one copy of the library could/would be loaded at once. That’s not an issue until you consider the fact that one plugin’s bundled (and outdated!) version may be loaded before the bundled version in your theme or plugin. This meant that you had to plan for the lowest common denominator, which is not a long-term viable solution.

Enter CMB2.

After many hours of deliberation and discussion among the team at WDS, we determined it would be best to start fresh by forking CMB and creating an entirely new project that would no longer have to ‘care’ about backwards compatibility. We accomplished this by completely renaming every class, function, hook, and filter in the library. This ensures that CMB2 will not conflict with any version of the original CMB. Of course, none of that really mattered if we couldn’t solve the core issue: version management. As a result, CMB2 was built with a new mechanism to ensure it only loads the most recent version of CMB2 in your system. This ensures that a plugin with an old bundled version will not conflict or take precendent over your up-to-date version.

But of course we didn’t stop there.

Since we completely re-wrote the project, and didn’t need to keep backwards-compatibility, we spent a lot of time refactoring things to make them more functional and more flexible. We made so many changes, and we changed the name to the ambigous “CMB2”, hopefully abandoning the idea that the plugin is for ‘metaboxes only.’

A few examples of creative uses of CMB2 include user fields, options pages, front-end forms, taxonomy metadata, associating WordPress posts/pages, and modals for generating shortcodes. As you can see, its flexibility has outgrown its original title.

What has changed? 

CMB2 has undergone so many changes under the hood, it’s impossible to list them all, but I’ll do my best to list a few of the notable ones:

  • CMB2 is now an official plugin in the WordPress plugin repository, which may be a preferable solution under certain circumstances.
  • All hooks and filters have been renamed, and in some cases the parameters passed to them have changed. We’ve been working feverishly to update the wiki to ensure accuracy. Is documentation your thing? We could use your help!
  • The old method for including the CMB core files is no longer applicable and you’re simply required to include it directly. If you’re using the plugin, simply activate the plugin.
  • A few parameters in the metaboxes and fields have changed. For example, the 'pages' metabox parameter has been changed to 'object_types' to more accurately reflect its purpose.
  • All markup has been converted from tables to generic divs with classes. This should help tremendously with your front-end responsive styling.
  • All strings have been properly localized, and Finnish, French and Spanish translations are included. We’re on Transifex, help us translate?
  • Numerous UI tweaks, fixes, additions, and improvements.
  • Many new filters and actions for hooking in to CMB2.

I would be remiss if I didn’t mention the awesome support and community we have on github. We thank so many contributors for making CMB2 awesome and continuing to push it forward. Feel free to join them!

Until today, CMB2 has been stamped with a big “beta” label as we wanted everyone to clearly understand that things could and probably would break. Now, we are officially releasing CMB2 (technically now 2.0.1), and we plan on maintaining strict backwards-compatibility going forward.

Thanks for letting me introduce you to CMB2, and I hope it becomes as invaluable a tool in your WordPress toolbox as it has ours.

If you can’t get enough of CMB2, here are some additional resources:

Give me a shout in the comments if you love (or hate?) CMB2.

Download (or fork) CMB2 on github, or install from

9 thoughts on “CMB2 WordPress Plugin: What is it good for? Absolutely everything!

  1. Hm, that was some good click baiting. I was really interested because of the title. It made it sound like WebDevStudios was dropping CMB and CMB2.

    1. Well, CMB2 has many abstraction layers, so it’s definitely possibly to use it to accomplish those things, though isn’t included ‘out of the box’.

  2. Couldn’t have done half as much with WordPress where it not for CMB, thanks for creating this library and letting the world use it, it makes WordPress infinitely more powerful and customisable.

Have a comment?

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