Title: user_id sorting broken
Last modified: May 7, 2026

---

# user_id sorting broken

 *  [airdrummer](https://wordpress.org/support/users/airdrummer/)
 * (@airdrummer)
 * [3 days, 8 hours ago](https://wordpress.org/support/topic/user_id-sorting-broken/)
 * sorry if this isn’t the right plugin, but wpmem’s fields tab enables user_id 
   display on the user admin page, along with registration date & ip, which are 
   sortable columns (vanilla wp users admin page has neither columns nor sortability)
 * [https://cardinalglen.org/wp-admin/users.php?orderby=user_registered&order=asc](https://cardinalglen.org/wp-admin/users.php?orderby=user_registered&order=asc)
   works as expected, but
 * [https://cardinalglen.org/wp-admin/users.php?orderby=wpmem_reg_ip&order=asc](https://cardinalglen.org/wp-admin/users.php?orderby=wpmem_reg_ip&order=asc)
   and [https://cardinalglen.org/wp-admin/users.php?orderby=user_id&order=asc](https://cardinalglen.org/wp-admin/users.php?orderby=user_id&order=asc)
   give semi-sorted results-\
 * pointers appreciated
 * btw claude sez: “Thanks for the link! And apologies — I got the author wrong.**
   WP-Members** is by **Chad Butler** at **RocketGeek**, not “ButterBean.” I should
   have been upfront about uncertainty rather than stating incorrect details confidently.”
   along with no useful help=\

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Chad Butler](https://wordpress.org/support/users/cbutlerjr/)
 * (@cbutlerjr)
 * [3 days, 6 hours ago](https://wordpress.org/support/topic/user_id-sorting-broken/#post-18901928)
 * They aren’t sortable columns. So are you just adding the query args to the URL
   manually? If so, that’s not going to sort anything.
   If you’ve applied some customization
   to do sorting of the user table, then you need to make sure it sorts by the value
   given. In the case of the user IP, it’s a meta field. For the user ID, it’s not;
   it’s a wp_user field.
 *  Thread Starter [airdrummer](https://wordpress.org/support/users/airdrummer/)
 * (@airdrummer)
 * [3 days, 4 hours ago](https://wordpress.org/support/topic/user_id-sorting-broken/#post-18902069)
 * sorry for goatrope, those are the columns’ headers’ links… i found this in my
   functions.php:
 * /*
    - Make our “Registration date” column sortable
    - [@param](https://wordpress.org/support/users/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(‘user_registered’ => ‘user_registered’,‘wpmem_reg_ip’ => ‘wpmem_reg_ip’,‘
   user_id’ => ‘user_id’), $columns );}
 * which seems to be part of [https://rudrastyh.com/wordpress/sortable-date-user-registered-column.html](https://rudrastyh.com/wordpress/sortable-date-user-registered-column.html)
 * chatgpt reveals that i’m missing `pre_get_users` to patch the query for meta 
   sort, but that doesn’t explain why user_id is fupduck, or why user_registered
   works when the sortable key is ‘registered’ not ‘user_registered’
 *  Plugin Author [Chad Butler](https://wordpress.org/support/users/cbutlerjr/)
 * (@cbutlerjr)
 * [1 day, 3 hours ago](https://wordpress.org/support/topic/user_id-sorting-broken/#post-18903605)
 * If all you’re doing is what is at this guy’s code snippet and adding the custom
   columns you noted above, `user_registered` and `registered` shouldn’t make a 
   difference, so I’m not sure why you would have a different result between the
   two.
 * The problem you’re having with the ID is because that code snippet is extending
   the existing `WP_List_Table` class, which as some already built in stuff. So 
   unless you add in your own sort, passing `user_id` makes it try to sort by that
   value – but that isn’t value in the `WP_User` object. It’s `ID`. Your array key/
   value pair needs to be:
 * `'user_id' => 'ID'`
    -  This reply was modified 1 day, 3 hours ago by [Chad Butler](https://wordpress.org/support/users/cbutlerjr/).

Viewing 3 replies - 1 through 3 (of 3 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fuser_id-sorting-broken%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/wp-members/assets/icon-256x256.png?rev=1226414)
 * [WP-Members Membership Plugin](https://wordpress.org/plugins/wp-members/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-members/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-members/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-members/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-members/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-members/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Chad Butler](https://wordpress.org/support/users/cbutlerjr/)
 * Last activity: [1 day, 3 hours ago](https://wordpress.org/support/topic/user_id-sorting-broken/#post-18903605)
 * Status: not a support question