I’m not sure where the problem lies, but the code below just doesn’t have the effect of ordering by ID in descending order.
$args['role'] = 'subscriber';
$args['orderby'] = 'ID';
$args['order'] = 'DESC';
$args['fields'] = 'all_with_meta';
$args['meta_query'] = $meta_query; // $meta_query is an array specified someplace above
$my_users = get_users( $args );
I’m aware that by default, WordPress is sorting by ‘login’ and in ASC order.
Any help here? Thanks in advance!
Try putting the args into an array.
If you are struggling with using
get_users()
and sorting the result by the value you want, you might have a look at this topic: How can I sort get_users() by any value (last_name, user defined fields and more)