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:
- Custom field/meta populated by dropdown of existing posts?
- What is the index [0] for on post meta fields?
- Individual Widgets per Page
- Gutenberg add a custom metabox to default blocks
- ‘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?
- Custom field metabox not showing in back-end
- How to hide meta box values from custom fields list?
- Adding another state (spam, reject, approve) to wordpress comments?
- Arrange custom fields with drag and drop?
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- Unable to get Preview of Uploaded image within a Custom Meta box
- Using media-upload.php to upload mp3 via custom fields
- extend Meta Box / Document Panel
- Add custom option to Standard Page Attributes Meta Box
- How to store the value of a custom field dropdown select for post referencing?
- Add multiple images to a page sidebar
- Only show metabox when date-value in other metabox is over?
- Custom Meta Boxes: Store two values in one repeatable field
- 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
- How to reload the role specific registration form on validation errors?
- 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 in custom meta boxes
- Multiplile values checkbox or select in custom meta box
- Create custom field key upon theme activation
- Problem with adding exta field in metabox in custom post type
- Adding a custom field or metabox to the post-thumbnail widget?
- Custom fields to save multiple values
- How do I add custom_meta_box_id’s value?
- Undefined index error when saving content on metabox
- How to save multiple metaboxes?
- Metabox with multiple fields added by user and upload box
- 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
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- How to construct multiple meta boxes
- Loading scripts to the Post Edit page only
- Force hide custom field metaboxes
- Saving custom profile fields
- Woocommerce with metabox plugin
- wp_editor removes paragraph from custom meta box
- How to Display Custom Meta Box only on Specific Page IDs
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Register rest field for specific user
- Metabox will not save
- How to check for specific meta box value on front end and output accordingly
- Where did the Add New Custom Field go?
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- Admin meta Image Path
- Tweak Meta for Post to work it for Pages also
- Odd PHP Code To Display HTML Of Meta Box [closed]
- Add conditional custom option to ‘Display name publicly as’ dropdown
- 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
- how to fetch the meta field keys/meta boxes from a post type?
- How to Create Dynamic Fields in a Meta Box?
- Set front page option using custom fields?
- When post is updated, custom metadata in text area field is overwritten
- Call the latest posts from a custom field group to be displayed on front-page
- Custom Meta Boxes and Fields for WordPress: Change directory upload based on user-edit page
- wp_postmeta are updated for only one page
- My meta boxes update wp_postmeta of posts but not of pages. What is wrong with the code?
- Meta Box Data added to header redirect
- Can i categorise my meta box?
- Custom metaboxes not saving after switching themes
- Custom Metaboxes, multiple post selection
- I want my post to republish again after adding a custom field
- added a meta box to post however when saving menu while debug on throws a warning
- When editing a post with a custom meta box the values aren’t displaying correctly
- Use Metabox to enter Post Title
- Include custom fields into the content of a regular page
- Get fields from metabox array
- Creating an If/Else statement using WPAlchemy MetaBox radio boxs
- How to get the value of particular get $meta value in wordpress
- Display custom field value into content with hyperlink
- Using CMB2 Plugin to create text_date metabox (datepicker) How do I save multiple dates? [closed]
- file upload user profile
- Dynamic background image used in css after selector
- 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
- doesn’t save custom meta box data wordpress