Wordpress: sort registered user Posts column by count in the admin dashboard?

Viewed 54

I have a functions code, that sorts my registration date in the Wordpress admin dashboard, when "All Users - > Users" is selected:

/*
 * Make our "Registration date" column sortable
 * @param array $columns Array of all user sortable columns {column ID} => {orderby GET-param} 
 */
add_filter( 'manage_users_sortable_columns', 'rudr_make_registered_column_sortable' );
 
function rudr_make_registered_column_sortable( $columns ) {
    return wp_parse_args( array( 'registration_date' => 'registered' ), $columns );
}

My question is how can I make the same for Posts?

Basically I want to sort Posts column by count to see which users made the most posts.

I know I probably need to make slight changes in the above code, but been struggling for a while.

Need help.

0 Answers
Related