Title: list users shortcode
Last modified: April 6, 2022

---

# list users shortcode

 *  Resolved [fugarul](https://wordpress.org/support/users/fugarul/)
 * (@fugarul)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/list-users-shortcode/)
 * Hello,
 * I there a shortcode to list users with certain role?
    Thank you.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Caseproof LLC](https://wordpress.org/support/users/caseproof/)
 * (@caseproof)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/list-users-shortcode/#post-15540874)
 * Hi [@fugarul](https://wordpress.org/support/users/fugarul/)
 * We don’t have a shortcode to display the list of users, but you can try to add
   this code at the end of your theme’s functions.php file:
 *     ```
       add_shortcode('mb-display-users-role', function($atts) {
         if(!isset($atts['role'])) return;
   
         $users = get_users( array('role' => $atts['role']));
         if(empty($users)) return;
   
         echo '<ul>';
         foreach ( $users as $user ) {
           echo '<li>' . esc_html( $user->display_name ) . '</li>';
         }
         echo '</ul>';
       });
       ```
   
 * and then use `[mb-display-users-role role="subscriber"]` shortcode with your 
   role.
 * Hopefully, that helps.

Viewing 1 replies (of 1 total)

The topic ‘list users shortcode’ is closed to new replies.

 * ![](https://ps.w.org/members/assets/icon-256x256.png?rev=3508404)
 * [Members - Membership & User Role Editor Plugin](https://wordpress.org/plugins/members/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/members/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/members/)
 * [Active Topics](https://wordpress.org/support/plugin/members/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/members/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/members/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Caseproof LLC](https://wordpress.org/support/users/caseproof/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/list-users-shortcode/#post-15540874)
 * Status: resolved