Custom Metaboxes Plugin 0.7: New Features & Setup Guide

» Download the CMB Library here

About six months have passed since the original Custom Metaboxes post introducing this lightweight library for creating metaboxes in WordPress. If you haven’t checked it recently, visit the project on Github to view the latest version and consult the wiki for documentation and examples.

Key features

  • Create metaboxes with simple, declarative arrays instead of lengthy procedural code. The library dramatically reduces boilerplate and makes metabox configuration easier to read and maintain.
  • Choose from a wide selection of included field types or extend the library with your own custom types. The built-in collection covers most common use cases while providing hooks to add specialized inputs.
  • Control where metaboxes appear: limit them to specific post types, page templates, page IDs, or add custom show_on filters to define precise display rules.
  • Use the library in themes and plugins simultaneously. When initialized correctly, it supports being included by a theme and multiple plugins without conflict.

Favorite field types

  • WYSIWYG editor. On modern WordPress versions this integrates with the native editor for a familiar and flexible editing experience.
  • Taxonomy fields (select, radio, multicheck). These let you present taxonomies in compact controls instead of the large default box, and select or radio controls are useful when you want to restrict users to a single term.
  • File upload. Integrates with the media uploader and lets you store either a file URL or an attachment ID so you can access different image sizes later.
  • Title. Add subheadings or inline instructions inside a metabox to improve clarity when you have many fields.
  • Text fields (standard, medium, small). Simple and versatile inputs used for the majority of meta values.
  • text_date_timestamp. A date picker that saves values as UNIX timestamps — ideal for event-related meta so you can perform date-based queries easily.

Many developers have contributed to the project, including Andrew Norcross, Jared Atchison, Travis Smith, Randy Hoyt, Jeremy Pry, Andrew Ryno, Patrick Forringer, Chris Olbekson, Stefan Crain, and others.

Please feel free to use the library and contribute improvements. If you build new field types or show_on filters, add them to the wiki. If you discover bugs, report them in the project’s issue tracker and consider submitting fixes or pull requests to help the community.