Display user roles created via WP in Profile form

This article will provide an example code for displaying the user roles created by WP or third-party plugins in the profile form. 

If you have created the roles via Ultimate Member, you can add the Roles field in wp-admin>Ultimate Member> Forms> Edit Profile form. You can read the complete guide here.

To display data in profile form, we usually add a field. However, role fields may contain only the user roles created by Ultimate Member and predefined role Subscriber. User roles created by third-party plugins are excluded to avoid conflicts. You can use the sample code below using the  [um_display_role] to display the user role created via WP: