• Resolved virtualgeorge

    (@virtualgeorge)


    I would like to generate a page or report that shows all users sorted by role so I can list all my site owners(administrators) and subscribers separately?

    I really just want a list of all administrators and a link or path to their site would be great.

    Is there a plugin to do that or is it easy to create a function using something like:
    $user_query = new WP_User_Query( array( 'role' => 'Administrator' ) );
    ?

    I found this site https://generatewp.com/wp_user_query/
    which generated this code for me:

    // WP_User_Query arguments
    $args = array (
    	'role'           => 'Administrator',
    	'number'         => '100',
    	'order'          => 'DESC',
    	'orderby'        => 'user_registered',
    	'count_total'    => true,
    	'fields'         => 'all',
    );
    
    // The User Query
    $user_query = new WP_User_Query( $args );

    But I don’t know how to write the function that would allow me to use a shortcode on a page?

    Thanks for assistance ??

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Generate report that shows users by role (Administrators)’ is closed to new replies.