Reputation:
I've to modify a query used in a Wordpress Theme because it's not orders users by their registration date. I need to shown last subscribed users. This query uses like ordering arg:
$args['orderby'] = 'rand'
What's it means?
I sobstituite this code row with
$args['orderby'] = 'user_registered'
but users shown aren't last subscribed users.
Can you help me, please? Thank's!
Upvotes: 1
Views: 2585
Reputation: 81
Try this. It's working.
// define the pre_get_users callback
function action_pre_user_query( $u_query ) {
$u_query->query_vars['orderby'] = 'user_registered';
$u_query->query_vars['order'] = 'DESC';
}
add_action( 'pre_get_users', 'action_pre_user_query');
Upvotes: 2