Opened 5 years ago
Last modified 5 years ago
#49418 new enhancement
Ability to order users by number of posts in custom post type
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | trivial | Version: | 5.4 |
Component: | Users | Keywords: | |
Focuses: | Cc: |
Description
When searching for users by post_count, post type post
is hardcoded in WP_User_Query
class at line 765. I would like to suggest adding a parameter that allows sorting users by post count in a custom post type.
Attachments (1)
Note: See
TracTickets for help on using
tickets.
@meevly Thanks for the ticket and welcome to Trac!
This functionality would be more appropriate in a plugin instead of core, especially if one person wants a count for a specific custom post type and another wants to sort on the total of multiple post types. (See also related ticket:15200#comment:1 about showing the counts.)
Admin Columns Pro might work for you. The free version enables you add a Post Count column for a custom post type, and sorting that column is a Pro feature.
https://wordpress.org/plugins/codepress-admin-columns/
I found out about that plugin when searching the support forum:
https://wordpress.org/support/topic/sort-user-php-by-last-name/
And there is at least one support topic about creating your own solution:
https://wordpress.org/support/topic/creating-custom-columns-of-users-and-sorting-them/