There is a list of roles in the $wp_roles WordPress global object.
Set $wp_roles to a global at the top of your method of function:
global $wp_roles;
Use a Select Field to populate the options:
array(
'id' => $prefix . 'role',
'name' => 'Role',
'type' => 'select',
'use_ajax' => false,
'options' => $wp_roles->get_names(),
),
Note: I didn’t install Humanmade CMB to test this code.
Related Posts:
- Individual Widgets per Page
- ‘Preview Changes’ for custom meta boxes?
- Using TinyMce with textareas in meta boxes on custom post types
- add meta box – custom field : which to choose?
- Add metabox to document tab in gutenberg
- How to add add_meta_box to specific Page Template?
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- extend Meta Box / Document Panel
- Add custom option to Standard Page Attributes Meta Box
- Add multiple images to a page sidebar
- Only show metabox when date-value in other metabox is over?
- Populating meta box with select-list of existing posts, and assigning it to custom post types
- Create meta boxes that don’t show in custom fields
- How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?
- How to load php file for specific page in admin?
- How to set default metaboxes on user creation?
- Metabox nonce PHP notice
- TinyMCE in Custom Metabox not loaded after upgrading from WP 3.1.4 to WP 3.2
- wp_editor in add_meta_boxes does not show gallery
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- Problem with adding exta field in metabox in custom post type
- Adding a custom field or metabox to the post-thumbnail widget?
- How do I add custom_meta_box_id’s value?
- add meta box using function.php
- Metabox image upload and custom field
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- My metabox class
- How to construct multiple meta boxes
- Loading scripts to the Post Edit page only
- Force hide custom field metaboxes
- Woocommerce with metabox plugin
- How to Display Custom Meta Box only on Specific Page IDs
- Register rest field for specific user
- Metabox will not save
- How to check for specific meta box value on front end and output accordingly
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- Tweak Meta for Post to work it for Pages also
- custom field not saved
- How to show a gloabl message on a user profile page (in back end)?
- How to create a Custom Meta Box with Name/Value Admin User Input Fields?
- Create Multiple File Upload Metabox in WordPress
- Users Select inside custom metabox
- Custom Metabox Not Saving
- Better Method for Multiple Meta Boxes
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- Unsaved changes in metabox inputs not detected in the block editor
- Custom Meta Box (SELECT) Not Saving
- Get updated meta value after post update or published (custom post type) using hook
- Button inside Custom Meta Box triggering the Update Button
- Why is my Custom Meta Box Field Inputs NOT saving?
- Add additional ‘description’ field for defined roles / role metadata?
- custom-meta-box checkboxes from loop won’t save
- Custom Metabox additional item
- get_posts in meta box dropdown not showing latest posts
- How can you include custom post meta in search without calling each key?
- When creating a metabox do you have to create DB fields for the data?
- Specific coditional usage [closed]
- Set checkbox as checked by default in a metabox
- Singleton Custom Field (Meta Box)
- Custom metabox not displaying multiselect data in edit mode
- How to validate select field in post meta?
- Is it preferable to use custom code to create metaboxes instead of plugins (such as ACF) and if so why? [closed]
- Values entered in a meta box aren’t saved
- How add multiple wp_editor_box to new post
- Displaying pages with a specific custom meta
- Enable a short code in the custom meta field
- How to validation for sanitize_URL?
- put saved metabox values back into fields and then display on the front end
- Custom metabox not working
- Trying to implement AJAX into my admin pages. Am I improperly enqueue and localizing my scripts?
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- Show array of meta_value in Edit Post Coloum
- How to display data from custom fields I created?
- Display metabox title for custom fields with values
- WP E-Commerce Custom Meta > Serialized array
- Custom Field & Gravity Forms [closed]
- Working with multiple values and metaboxes
- Gutenberg add a custom metabox to default blocks
- HTML for adding a meta box (basic text field) to page editor?
- Move the metaboxes to the very top of post editor
- How to improve my non-unique metadata MySQL entries?
- Adding text box with add_meta_box
- Add forms dynamically in admin pages?
- add meta box considers the selected option as post parent
- How do I display a custom field in an existing form on the front end?
- Hide custom fields by user’s role
- get wordpress post loop by meta box date
- Sub Field of File Field
- If metabox fields has content display content
- Can’t save meta field value if the title not set
- Display Data From This Custom Media Upload Meta Box?
- Call the latest posts from a custom field group to be displayed on front-page
- My meta boxes update wp_postmeta of posts but not of pages. What is wrong with the code?
- I want my post to republish again after adding a custom field
- Creating an If/Else statement using WPAlchemy MetaBox radio boxs
- file upload user profile
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Saving multiple custom meta box fields
- Custom fields empty after refreshing page
- Custom post type needs to capability to create and edit by some specific user role