• Resolved liamdooles

    (@liamdooles)


    Is there some code or a plugin that I can insert on to a specific page that can showcase the users current role they’re assigned?

    • This topic was modified 5 years, 12 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Users can have ore than one role, this will output the first role listed.
    <?php echo 'Your role: ', wp_get_current_user()->roles[0]; ?>

    This would be inserted on a template file, not within post content. If you want it within content it needs to be wrapped into a shortcode or custom block. If you want to alter template files, it’s recommended you create a child theme.

    Thread Starter liamdooles

    (@liamdooles)

    This worked a treat!

    Thank you so much 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Add users current role’ is closed to new replies.