CMB2
CMB2 is a metabox, custom fields, and forms library for WordPress that will blow your mind.
Escolha segura
Yes — CMB2 is a safe, well-maintained plugin to use in 2026. It runs on 300K+ sites, is rated 5/5 and was last updated 1 month ago, and scores 89/100 on our health check.
- Comprovado em escala em mais de 300 mil sites ativos
- Loved by users — 5/5 from 91 reviews
- Testado com as últimas WordPress (7.1)
Como ele se acumula?
Lado a lado em instalações, atualizações, avaliações e suporteDownloads diários
Os picos de download geralmente seguem uma nova versão — cada site que atualiza automaticamente é um download.
Rankings
Where CMB2 stands todayWordPress.org Classificações de pesquisa
Posição ao vivo na pesquisa de plugins, top 100| Palavra chave | Posição |
|---|---|
| fields | #83 |
| formulários | >100 |
| metaboxes | #2 |
| options | #37 |
| settings | #12 |
Adoção da versão
Compartilhamento de sites ativos por lançamento.
Divisão de classificação
★★★★★★★★★★ 5 from 91 reviews
About CMB2
From the official readme · v2.13.5Descrição
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.
Contribution
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
Recursos:
- 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.
Translation
If you are looking to provide language translation files, Please do so via WordPress Plugin Translations.
Documentação
- CMB2 documentation can be found at the CMB2 wiki on github. Also, If you’re into reading code and inline documentation, we tried to keep all functions and methods fully inline-documented.
3rd Party Resources
Custom Field Types
- CMB2 Field Type: CMB Attached Posts Field from coreymcollins:
custom_attached_posts, for attaching posts to a page. - 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: Ajax Search from rubengc: 3 different fields with the same UI in AJAX to search (with query parameters) to users, post type and taxonomy terms.
- CMB2 Field Type: CMB2 User Search field from Mte90:
user_search_textadds a user-search dialog for searching/attaching other User IDs. -
CMB2 Field Type: Google Maps from mustardBees: Custom field type for Google Maps.
The
pw_mapfield stores the latitude/longitude values which you can then use to display a map in your theme. -
CMB2 Field Type: Leaflet Maps from villeristi: Custom field type for Leaflet Maps.
-
CMB2 Field Type: Select2 from mustardBees: Custom field types which use the Select2 script:
- The
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 - The
pw_multiselectfield allows you to select multiple values with typeahead-style search. The values can be dragged and dropped to reorder
- The
-
CMB Field Type: Slider from mattkrupnik: Adds a jQuery UI Slider field.
- WDS CMB2 Date Range Field from dustyf of WebDevStudios: Adds a date range field.
- CMB2 Remote Image Select from JayWood of WebDevStudios: Allows users to enter a URL in a text field and select a single image for use in post meta. Similar to Facebook’s featured image selector.
- 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: MultidatesPicker: Creates a CMB2 field type that enables a multiple date calendar. It uses a plugin called MultiDatesPicker v1.6.3 for jQuery UI.
- 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: Order by rubengc: Allows users to define custom order of predefined options.
- CMB2 Field Type: Animation by rubengc: Allows users to pickup an animation from Animate.css (includes preview of chosen animation).
- CMB2 Field Type: Ajax Search by rubengc: Based on CMB2 Field Type: Post Search Ajax, adds the ability to attach posts/users/terms, and the ability to limit the maximum number of attached objects.
- CMB2 Field Type: Visual Style Editor by rubengc: Custom field for CMB2 which allows customizing style from a small set of controls.
- CMB2 Field Type: Content Wrap by rubengc: Custom field for CMB2 to store a content wrap values (padding, margin or border width).
- CMB2 Field JS Controls by rubengc: Show any field similar to WordPress publishing actions (Post/Page post_status, visibility and post_date submit box field).
- CMB2 Field Type: Position by rubengc: CMB2 field type to setup a jquery UI position values.
- CMB2 Field Type: CMB2 Roadway Segments by pixelwatt: This plugin adds a new CMB2 fieldtype for drawing roadway segments onto a map and provides a shortcode for display.
- CMB2 Field Type: Font Awesome by serkanalgur: This plugin adds a new CMB2 field type for selecting Font Awesome icons.
- CMB2 Field Type: Typography by eduplessis: This plugin adds a new CMB2 field type “Typography” and it use jQuery fontselect for the font-family selection.
- CMB2 Field Type: Markdown by Rekenna: This plugin adds a new CMB2 field type “CMB2 Markdown” where you can type in markdown and view a live preview of the results or convert to html with a button.
- CMB2 Field Type: Switch Button by themevan: This plugin adds a Custom Switch Button field type for CMB2.
- CMB2 Field Type: select_plus from manzoorwanijk: Select field type which acts much like the default
selectfield. However, it adds the support foroptgroupand saving of values withmultipleattribute. - CMB2 Field Type: Address by scottsawyer: Just a simple, repeatable address field. It’s really just the snippet from CMB2 Snippet Library converted to a plugin.
- CMB2 Field Type: Link by scottsawyer: Create a link field with some attributes. Very nice for styling links.
- CMB2 Field Type: Widget Selector by scottsawyer: Need a field that lets you ( or your editor ) select / display an existing widget instance? Then this is the plugin for you.
Other Helpful Resources
- CMB2 WooCommerce HPOS Orders: Adds the ability to add custom fields to the new WooCommerce HPOS orders page.
- 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..
Links
Known Issues
- Metabox containing WYSIWYG editor cannot be moved or used in a repeatable way at this time (this is a TinyMCE issue).
- Not all fields work well in a repeatable group.
Instalação
If installing the plugin from wordpress.org:
- Upload the entire
/CMB2directory to the/wp-content/plugins/directory. - 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.
- Profit.
If including the library in your plugin or theme:
- Place the CMB directory inside of your theme or plugin.
- Copy (and rename if desired)
example-functions.phpinto a folder above the CMB directory OR copy the entirety of its contents to your theme’sfunctions.phpfile. - Edit to only include the fields you need and rename the functions (CMB directory should be left unedited in order to easily update the library).
- Profit.
Log de Changes
Security release: fixes stored cross-site scripting in grouped wysiwyg fields. On sites that render a front-end CMB2 form (cmb2_get_metabox_form()) with such a field, an unauthenticated visitor could save markup that runs for anyone viewing that form or the post's edit screen. Update recommended.
2.13.5
Enhancements
- [Development] Fixed the PHPUnit CI legs that test against the latest WordPress: they now use the test suite tagged for the latest stable release instead of wordpress-develop trunk, which can require core APIs a stable release does not have yet.
Correções de bugs
- Fixed
multicheckandmulticheck_inlinefields (including inside a group) not saving when the only checked option has the value0. Non-repeatable array values that hold only0or'0', such as from custom field types, are no longer treated as empty and deleted on save. Such a field now storesarray( '0' ), sometadata_exists()returns true,cmb2_save_fieldreportsupdatedinstead ofremoved, and a field with adefaultno longer falls back to that default when only0is checked. Props @faisalahammad. Fixes #1535 (#1572). - Fixed repeatable fields (including repeatable fields in a group) dropping a
0or'0'entry on save and not showing a saved0row on the edit screen, so the next save removed it. A0entry is now kept and passed to the field type’s sanitizer like any other entry: repeatabletext_urlstores the fielddefault(orfalse),text_emailstores'',text_date_timestampstores timestamp0, and atext_datetime_timestamprow that parses to epoch0is kept (the edit screen still shows a0timestamp as empty, so re-saving the form removes that row). Customsanitization_cbcallbacks andcmb2_sanitize_{$type}filters now receive'0'entries in repeatable arrays, andsanitization_cb => falsestores them. A repeatabletext_moneyentry of0now saves as0.00instead of being removed. Props @faisalahammad (#1574). - Fixed a repeatable field saving its hidden “empty row” template as an extra row on every save. This happened when the template had a value, such as a repeatable
selectwithoutshow_option_none(its first option was saved) or a field with adefault. The template row’s inputs are now rendered withdisabledand adata-cmb2-templateattribute, so the browser does not submit them, and the Add Row button enables them. Custom JavaScript that copies.empty-rowitself, instead of using the Add Row button, must removedisabledfrom inputs that havedata-cmb2-template. Props @faisalahammad (#1574). - Fixed
wysiwygfields inside a group not escaping their saved value in the editor. The editor now loads the content exactly as saved: entities such as&are no longer decoded on load (and then saved decoded), and saved markup such as a</textarea>tag stays inside the editor. Props Jakub Herman (via Wordfence). - Fixed removing the only row of a repeatable field inside a group adding an empty row to the other repeatable fields in that group and its other entries. The reset now fires
cmb2_add_rowonce, on the clicked field’s table, instead of once per repeatable table in the group, and removing the last row while the field’s Add Row button isdisablednow does nothing instead of throwingMaximum call stack size exceeded. Props @faisalahammad. Fixes #1515 (#1573).
2.13.4
Enhancements
- Added the
rest_enforce_user_read_permissionsbox property and thecmb2_rest_enforce_user_read_permissionsfilter (off by default). When enabled, REST field reads of a user that core does not show (a user with no published posts, read by someone other than that user or a holder ofedit_user/list_users) are denied. While neither declares an explicittrueorfalse(the filter defaults tonull), such a read stays allowed and emits a deprecation notice (anX-WP-DeprecatedParamheader and a debug-log line whenWP_DEBUG/WP_DEBUG_LOGare on), since the default will change in a future version. Set the property or filter tofalseto keep the current behavior. - Updated the alpha color picker script (
wp-color-picker-alpha) to 3.0.4. Alphacolorpickerfields now outputdata-alpha-enabledinstead ofdata-alpha; if you setdata-alphayourself through a field’sattributes, rename it todata-alpha-enabled. Props Sajib Talukder (@stalukder03) (#1542). - [Development] Added Dependabot version updates for npm and GitHub Actions (monthly, one grouped PR per ecosystem), and applied its first round of dev-tooling and workflow action updates (#1567, #1568).
- [Development] Restricted the GitHub Actions
GITHUB_TOKENto read-only in all workflows, and moved the Playwright workflow to Node 22. - [Development] Expanded
SECURITY.mdwith an email fallback for reports, CVE handling and scope.
Correções de bugs
- Object IDs that CMB2 reads from the request (
user_id,c,tag_IDandpost, used when a box has no object ID set) are now cast to integers, the way WordPress reads them on its own edit screens, and theoembedfield escapes itsdata-objectidanddata-objecttypeattributes. Core save hooks pass explicit IDs and are unaffected. A front-endsave_fields()call with no ID now resolves a non-numericuser_idto the current user, as core’s profile screen does, rather than to a string ID that matched no user.cmb2_set_object_idfilter callbacks and customcmb2_override_meta_*storage now receive an integer for these keys. Props T3pp31 (@T3pp31) (via GitHub security advisory). - The CMB2 REST field endpoints (
/cmb2/v1/boxes/{box}/fieldsand/fields/{field}) now follow WordPress core’s REST read permissions for the requested object. Reads of a post in a non-public status (draft, pending, private, future, trash); of a post, or an attachment’s parent, whose type is not shown in REST and is not one of the box’s own post types; or of a comment core does not show (unapproved, on a post the requester cannot read, or on a password-protected post the requester cannot edit) return a 401/403 unless the requester can read that object. For anonymous requests this matches core’s own routes. Published and password-protected posts, terms, options pages and custom object types are unchanged, and thecmb2_api_get_field_permissions_check/cmb2_api_get_fields_permissions_checkfilters (and box*_permissions_check_cbproperties) still have the final say. The fields collection now returns a 401/403 for such an object. Props T3pp31 (@T3pp31). - A REST field read in the same PHP process as an earlier read of a different object now returns the requested object’s value rather than the earlier object’s.
2.13.3
Correções de bugs
- The CMB2 REST boxes/fields endpoints now validate the
object_typeandobject_idparameters against the box’s registered object types. A request naming an object type the box is not registered for (a post-type box stores aspost), or, for an options-page box, an option key other than the box’s own, returns a 400 error instead of reading or writing that object. Stored data is unchanged. Props Avinash Hanwate (@ahanwate) (via GitHub security advisory).
2.13.2
Correções de bugs
- Escaped stored values in default field displays, including admin columns and front-end
display_cboutput. Stored HTML in defaulttextandtext_moneydisplays now appears as text.textarea_codepreserves visible source and uses<pre class="cmb2-code">in place of<xmp class="cmb2-code">; integrations selecting the old element should update their selector. Valid source remains unchanged in storage, while unexpected non-scalar values are discarded on save to avoid PHP errors. Props Kuba (via Wordfence).
2.13.1
Para desenvolvedores
Este é o seu plugin? Mostre os números.
Adicione um crachá ao vivo ao seu site, Documentos ou Readme do GitHub. Ele é atualizado por conta própria - nenhuma conta necessária.
Best CMB2 alternatives
All fields plugins →FAQ
CMB2: quick answers
Respostas diretas, extraídas de dados ao vivo WordPress.org.
Fonte: WordPress.org
Is CMB2 free?
Yes. CMB2 is free to download and use from the official WordPress.org plugin directory.
Is CMB2 safe to use in 2026?
Yes — CMB2 is a safe, well-maintained plugin to use in 2026. It runs on 300K+ sites, is rated 5/5 and was last updated 1 month ago, and scores 89/100 on our health check.
How many websites use CMB2?
CMB2 is active on 300K+ WordPress websites and has been downloaded 5,773,867 times since it launched in September 2014. It was downloaded 58,127 times in the last 30 days.
Does CMB2 work with WordPress 7.1?
Yes. The developer has tested CMB2 up to WordPress 7.1.5, the latest release. It requires WordPress 3.8.0 or newer.
What PHP version does CMB2 need?
CMB2 requires PHP 7.4 or higher. Most hosts run PHP 8.x today, so it works on any modern WordPress hosting.
When was CMB2 last updated?
The latest version, 2.13.5, was released on October 27, 2026 (1 month ago).
Who makes CMB2?
CMB2 is developed and maintained by Justin Sternberg.
What are the best alternatives to CMB2?
The most popular alternatives to CMB2 are Advanced Custom Fields (ACF… (2M+ installs), Secure Custom Fields (100K+ installs) and Advanced Custom Fields: Ext… (100K+ installs).
Alimentado por PageForge
Um modelo e uma planilha. Uma página real para cada pesquisa.
PageForge Transforma cada linha de um CSV em uma página WordPress com seu próprio título, URL, SEO campos e esquema, construído no layout que você já desenhou. Gratuito em WordPress.org.
- CSV e XLSX, mais Google Sheets em Profissional e Empresarial
- Seu próprio título, URL, SEO campos e esquema para cada página
- Funciona com o editor de blocos, Elementor, Divi e Avada
- Gratuito em WordPress.org, sem cartão de crédito
