<?php $args = array( 'role' => 'customer', 'orderby' => 'user_nicename', 'order' => 'ASC' ); $users = get_users( $args ); echo '<ul>'; foreach ( $users as $user ) { echo '<li>' . esc_html( $user->display_name ) . '[' . esc_html( $user->user_email ) . ']</li>'; } echo '</ul>';
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter