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
- Gutenberg add a custom metabox to default blocks
- Using TinyMce with textareas in meta boxes on custom post types
- How to add add_meta_box to specific Page Template?
- Adding another state (spam, reject, approve) to wordpress comments?
- Arrange custom fields with drag and drop?
- extend Meta Box / Document Panel
- Add multiple images to a page sidebar
- 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)
- Create custom field key upon theme activation
- Problem with adding exta field in metabox in custom post type
- How do I add custom_meta_box_id’s value?
- Undefined index error when saving content on metabox
- How to save multiple metaboxes?
- 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
- How to construct multiple meta boxes
- Force hide custom field metaboxes
- How to Display Custom Meta Box only on Specific Page IDs
- Register rest field for specific user
- Metabox will not save
- 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 create a Custom Meta Box with Name/Value Admin User Input Fields?
- Create Multiple File Upload Metabox in WordPress
- Custom Metabox Not Saving
- Better Method for Multiple Meta Boxes
- How to Create Dynamic Fields in a Meta Box?
- Set front page option using custom fields?
- Unsaved changes in metabox inputs not detected in the block editor
- Get updated meta value after post update or published (custom post type) using hook
- Button inside Custom Meta Box triggering the Update Button
- 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
- I need a “Choose from existing content” popin
- How can you include custom post meta in search without calling each key?
- Display Custom Field for a Specific Role, but not for Admin
- 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
- Move Title and the Content WYSIWYG editor position
- How to validate select field in post meta?
- How can I hide custom field from users used for caching response from external api?
- How to disable Edit Post and Allow only Custom Field?
- Displaying Meta-Box Data Properly
- Is it preferable to use custom code to create metaboxes instead of plugins (such as ACF) and if so why? [closed]
- How add multiple wp_editor_box to new post
- Displaying pages with a specific custom meta
- 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
- How to Convert Custom Fields from Text to Array?
- How to display data from custom fields I created?
- Display metabox title for custom fields with values
- WP E-Commerce Custom Meta > Serialized array
- show a specific metabox dependent on the page template
- Gutenberg add a custom metabox to default blocks
- Making custom meta box required (with error message if not filled in) on Gutenberg
- HTML for adding a meta box (basic text field) to page editor?
- How to improve my non-unique metadata MySQL entries?
- Adding text box with add_meta_box
- Add forms dynamically in admin pages?
- How can I ‘check’ the “custom fields” box from the Screen Options?
- 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
- Append custom field items to content from plugin
- Can’t save meta field value if the title not set
- Display Data From This Custom Media Upload Meta Box?
- 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
- My meta boxes update wp_postmeta of posts but not of pages. What is wrong with the code?
- Can i categorise my meta box?
- I want my post to republish again after adding a custom field
- 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
- Creating an If/Else statement using WPAlchemy MetaBox radio boxs
- How to get the value of particular get $meta value in wordpress
- file upload user profile
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Saving multiple custom meta box fields