The Custom Metaboxes and Fields for WordPress (CMB2) plugin is now officially out of beta and ready for public use. The tool was created to make it easy for developers to create metaboxes and forms with custom fields. Developers at WebDevStudios took over the original CMB GitHub repository from Jared Atchison, its original creator, in December of 2013.
Justin Sternberg explained why WebDevStudios chose to start contributing to the CMB2 project:
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.
Due to irreconcilable shortcomings in the original CMB, WebDevStudios opted to fork the project and create a new one that wouldn’t have the same backwards compatibility requirements. If you used CMB in the past, it’s important to note that the new CMB2 project has renamed every class, function, hook, and filter in the library to avoid conflicts with the original. It’s essentially a complete re-write.
“CMB2 was built with a new mechanism to ensure it only loads the most recent version of CMB2 in your system,” Sternberg said. “This ensures that a plugin with an old bundled version will not conflict or take precedence over your up-to-date version.”
The new CMB2 is now available on WordPress.org as a plugin for easy activation when you want to use it with one of your projects. As an alternative, you can include CMB2 directly. The newly released plugin features the following:
- Create metaboxes to be used on post edit screens.
- Create forms to be used on an options pages.
- Create forms to handle user meta and display them on user profile add/edit pages.
- Flexible API that allows you to use CMB forms almost anywhere, even on the front-end
- 30+ built-in field types
- Custom API hook that allows you to create your own field types
- Numerous hooks and filters, allowing you to modify many aspects of the library (without editing it directly)
- Repeatable fields for most field types are supported, as well as repeatable field groups
The WebDevStudios team plans to maintain strict backwards compatibility moving forward, as of CMB2’s 2.0.1 release on WordPress.org. If you want to include CMB2 as part of your next project, make sure to check out the plugin’s wiki and code library for tips on how to add metaboxes, fields, and forms to WordPress themes and plugins.