CMB2 is a metabox, custom fields, and forms library for WordPress that will blow your mind.
Contributors: jtsternberg, webdevstudios, zao, humanmade
Tags: metaboxes, forms, fields, options, settings
Requires at least: 3.8.0
Tested up to: 5.2.2
Stable tag: 2.6.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Complete contributors list found here: github.com/CMB2/CMB2/graphs/contributors
CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind. Easily manage meta for posts, terms, users, comments, or create custom option pages.
CMB2 is a complete rewrite of Custom Metaboxes and Fields for WordPress. To get started, please follow the examples in the included
example-functions.php file and have a look at the basic usage instructions.
You can see a list of available field types here.
If you are coming from the original "Custom Metaboxes and Fields for WordPress" plugin, please read this post for the CMB2 background story.
Development occurs on Github, and all contributions welcome. Please read the CONTRIBUTING doc for more details.
A complete list of all our awesome contributors found here: github.com/CMB2/CMB2/graphs/contributors
- 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.
- Create forms to handle term meta and display wherever your taxonomies are used.
- Flexible API that allows you to use CMB forms almost anywhere, even on the front-end.
- Several field types are included.
- Custom API hook that allows you to create your own field types.
- There are 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.
- CMB2 is safe to bundle with any project. It will only load the newest version in the system.
If you are looking to provide language translation files, Please do so via WordPress Plugin Translations.
CMB2 Field Type: Post Search Ajax by alexis-magina:
post_search_ajaxAttach posts to each other. Same approach as CMB2 Attached Posts Field but with Ajax request, multiple/single option, and different UI.
CMB2 Field Type: CMB2 Post Search field:
post_search_textadds a post-search dialog for searching/attaching other post IDs.
pw_mapfield stores the latitude/longitude values which you can then use to display a map in your theme.
pw_select fieldacts much like the default select field. However, it adds typeahead-style search allowing you to quickly make a selection from a large list
pw_multiselectfield allows you to select multiple values with typeahead-style search. The values can be dragged and dropped to reorder
CMB Field Type: Sorter: This plugin gives you two CMB field types based on the Sorter script.
CMB Field Type: Tags: WordPress-Tags-like field type for CMB2. note: this does not set the post tags, but simply provides a unique text input
CMB Field Type: Link Picker: Using the Link Picker for CMB2 control, you can choose a link from your WordPress site, or manually enter a link. You can also identify if the link should open in a new window, or not.
CMB Field Type: CMB2-radio-image: Image as radio buttons.
CMB2 Term Select: Special CMB2 Field that allows users to define an autocomplete text field for terms. Note: this will set the taxonomy terms, but has the option (
'apply_term' => false) to disable and save the term ids as data instead (like for options pages, etc).
CMB2 Related Links: Allows users to add a related links via a repeating field group. Field inputs are powered by the CMB2 Field Type: CMB2 Post Search field documented above, and so each link can be populated with existing WordPress content by clicking on the search button. Note: this is not a standard field type, but instead a function you use in combination with CMB2::add_field().
CMB2 Field Type: select_plus from manzoorwanijk: Select field type which acts much like the default
selectfield. However, it adds the support for
optgroupand saving of values with
- CMB2 Admin Extension: Adds a UI to create CMB2 meta boxes from the WordPress admin. Also on wordpress.org.
- WordPress Shortcode Button: Uses CMB2 fields to generate fields for shortcode input modals.
- WDS-Simple-Page-Builder: Uses existing template parts in the currently-active theme to build a customized page with rearrangeable elements. Built with CMB2.
- CMB2 Example Theme: Demonstrate how to include CMB2 in your theme, as well as some cool tips and tricks.
- facetwp-cmb2: FacetWP integration with CMB2.
- CMB2-grid from origgami: A grid system for WordPress CMB2 library that allows the creation of columns for a better layout in the admin.
- CMB2 Metatabs Options from rogerlos: CMO makes it easy to create options pages with multiple metaboxes--and optional WordPress admin tabs.
- CMB2 Conditionals from jcchavezs: Allows developers to relate fields so the display of one is conditional on the value of another.
- CMB2 Metabox Code Generator from willthemoor: Skip the boring bits. Use this generator to create fully functional CMB2 metaboxes easily. Now with bulk entry!
- Caldera Metaplate by CalderaWP: Not specific to CMB2, but allows creating templates for outputting your custom fields.
- Yoast CMB2 Field Analysis WP Plugin by alexis-magina: This plugin adds in a js based method of recalculating Yoast SEO's content scores when updating page content, specifically custom meta fields added via the CMB2 library.
- Skeleton by awethemes: A complete framework for WordPress, uses CMB2 engine.
- WP Simple Iconfonts by awethemes: An icon fonts manager and provides a font icon picker for CMB2.
- CMB2 Nav Menus by nsrosenqvist: Lets you use CMB2 in nav menu entries..
If installing the plugin from wordpress.org:
- Upload the entire
/CMB2directory to the
- Activate CMB2 through the 'Plugins' menu in WordPress.
- Copy (and rename if desired)
example-functions.phpinto to your theme or plugin's directory.
- Edit to only include the fields you need and rename the functions.
If including the library in your plugin or theme:
- Place the CMB2 directory inside of your theme or plugin.
- Copy (and rename if desired)
example-functions.phpinto a folder above the CMB2 directory OR copy the entirety of its contents to your theme's
- Edit to only include the fields you need and rename the functions (CMB2 directory should be left unedited in order to easily update the library).
- Not all fields work well in a repeatable group.