How to sort a non-meta field in the User Admin Panel?
The WP_User_Query::parse_orderby() actually supports sorting by the number of posts, but because WP_User_Query::parse_orderby() limits by what users can be sorted, accomplishing a custom sort is a bit of a hack. Here’s the workaround I’ve created (semi-tested): add_filter( ‘manage_users_sortable_columns’, static function ( $columns ) { $columns[‘articles_count’] = array( ‘articles_count’, false, __( ‘Articles’ ), __( ‘Table ordered … Read more