Support › General › Get list of user rolesResolved
I'm using metabox to get a list of users which is great
'id' => $prefix . 'user',
'type' => 'user',
'name' => esc_html__( 'Users', 'wtw' ),
'desc' => esc_html__( 'Select users who can view this contact information.', 'wtw' ),
'field_type' => 'checkbox_list',
'placeholder' => 'Select an author',
But is there a way to select user roles?
Thanks in advance
Meta Box has not supported the field type user roles yet. But you can create a custom field type to show a list of roles with a few lines of code.
Follow these links to get more details:
- Custom field type: https://docs.metabox.io/custom-field-type/
- Get roles: https://stackoverflow.com/questions/13162330/wordpress-list-user-roles
- Sample custom select field: https://support.metabox.io/topic/select-a-gravity-form-to-assign-to-a-cpt/
Thank you for the help