WP_User_Query order by registered

I am trying to get the list of a specific user type and order them by their registration date.

I searched for ways to do it from here https://codex.wordpress.org/Class_Reference/WP_User_Query#Order_.26_Orderby_Parameters to several Stackoverflow posts but nothing worked so far.

Could you check my code and tell me what’s wrong?

$args_tilisateur = array(
'role' => 'coureur',
    'orderby ' => 'registered',
    'order' => 'ASC'

$usi = new WP_User_Query( $args_tilisateur );

Then to display I do :

if ( !empty($usi->results) ) {
foreach ( $usi->results as $ut ):
    $user_id = $ut->ID;
    $user_info = get_userdata((int)$user_id);

And so on with echoing the values from $user_info.

Read more here: WP_User_Query order by registered

Leave a Reply

Your email address will not be published. Required fields are marked *