Add a Sortable User Registration Date Column to All Users Page
There are could be different situations in WordPress when you will need to sort users by registration date. For example you may notice that spam users has been registered recently on your website and it is kind of difficult to find them in your users list because by default it is sorted alphabetically.
In this tutorial we are about to create a “Registration date” column just like on the screenshot below and of course, what is most important we are going to make it sortable.

In order to implement this feature we don’t need to use any plugins (but we could of course), all we need to do is to use three WordPress filter hooks:
manage_users_columns
– to add a columnt to All Users page,manage_users_custom_column
– to display the registration date inside it,manage_users_sortable_columns
– to make it sortable.
Let’s get started!
If you don’t know where to insert the code from this tutorial, please check this guide.
/*
* Creating a column (it is also possible to remove some default ones)
*/
add_filter( 'manage_users_columns', 'rudr_modify_user_table' );
function rudr_modify_user_table( $columns ) {
// unset( $columns['posts'] ); // maybe you would like to remove default columns
$columns[ 'registration_date' ] = 'Registration date'; // add new
return $columns;
}
/*
* Fill our new column with registration dates of the users
*/
add_filter( 'manage_users_custom_column', 'rudr_modify_user_table_row', 10, 3 );
function rudr_modify_user_table_row( $row_output, $column_id_attr, $user ) {
$date_format = 'j M, Y H:i';
switch( $column_id_attr ) {
case 'registration_date' : {
return date( $date_format, strtotime( get_the_author_meta( 'registered', $user ) ) );
break;
}
default : {
break;
}
}
return $row_output;
}
/*
* Make our "Registration date" column sortable
*/
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 );
}
Some notes:
- On line 7 I am showing you how to remove a specific column if you don’t need it. I am using
posts
coumn ID but the other default ones arename
,email
androle
. Keep in mind that you can always hide those column in “Screen options” instead. - On line 19 I set the date format to display. You can use any format that supported by the
date()
PHP function. get_the_author_meta()
function returns the date user registered in the same format it is stored in database:2017-02-09 05:37:39
.- I am using
wp_parse_args()
to merge two arrays. If$columns
array already contains the element withregistration_date
key, this element value will be just updated.
If the column haven’t appeared in your WordPress admin area on the Users > All Users page or maybe you would like to hide the other columns without code — try to use “Screen Options” tab then.

If you have any questions left I’m ready to help you in comments.

Misha Rudrastyh
Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.
Need some developer help? Contact me
It is a very handy way to add registration column. Thanks alot for sharing it! Just one tiny little thing I have noticed; at the part for removing a column there is an “s” missing:
unset( $columns[ 'posts' ] );
Apart from that it works perfect! :)
Thank you :)
Hello Misha,
Thank you for the solution, would you please give us a hint how to make a sortable column for custom field ?
Thank you in advance.
Hello Jenz,
there are just two steps to implement it:
Step 1. Filter manage_{screen id}_sortable_columns
So, for users page, screen ID will be
users
.To make column sortable you just have to add one more array value there, ok, just like in the post above.
For default columns like registration date, implementing the first step is more than enough.
Step 2. pre_get_users hook
Well, I had no time to test it, but it supposed to work just like
pre_get_posts
filter. So, in theory the code will look like this:Please let me know if it works :)
Thank you so much, it works like charm.
Hello, Misha nice tutorial. Thanks
How can make the column decs by default. So that newly registered user can be seen top most by default.
Hello Hasan,
Would you like the column to be sortable as well?
Nice tuto Misha, thanks a lot!!
This column appears correctly but in my site the data is empty. Do you know what the reason may be?
Welcome 🙂
Did I understand correctly – the registration date isn’t displayed, is it?
Yes, the column title appears but the field with the date is empty.
Thanks a lot!
Hey,
I could try to help you with the code, just contact me.
OMG! I had an error in my own code. Now I see it correctly. Thanks a lot!!!
Thank you so much. I used the snipped and it worked like a charm.
Thank you for the tut.
Thank you !!!
Is it possible to sort by default Registeration Date DESC when I’m visiting the User section on admin ?
Thank you
Hmmm… try this snippet.
Perfect Misha, thank you !
in what file do I add this code…. and, can I still do it with the latest version of WordPress?
functions.php
of your current theme would be OK, but better – child theme, and better – custom plugin. Yes, it works perfectly with the latest WordPress.Thank you so much for this, Misha – I thought I was going to have to install a plugin which is crazy for what should be standard.
Hey Arthur,
Always welcome 🙃
Really useful – thanks Misha.
Just a quick note to say Thank you. Works great.
How do we add the “at” to the time so that it displays like this: 10th of february 2019 at 09:30
And not just 10th aug 09:30
Thanks for an awesome snippet by the way!
$date_format = 'j of F Y at H:i';
Thank you! Works great :)
Hello,
This is my first comment on your site.
Very nice job and well documented.
Is it possible to sort on multiple columns. For example sorting first on a “Pickup Location” column then on the “Pickup date” ?
Nice work.
How could i display the date format in german?
Thanks!
Sorry, I do not know what is german date format, do you mean “dd.mm.yyyy” ?
Thank you for sharing this very simple solution!
Thank you so much.
I just want to said big thank you
You’re welcome! 🙏🏼
Hi,
The registration and can be sorted before but for some reason, it can only show the registration but it can’t be sorted. Do you know the reason?
Kind Regards
hi, sorry, forget my comment earlier. Your code works like a charm. Thanks
Works like a charm. Thank you.
Perfect and Thanks. I have used a lot of your Snippets to my Blogs and Woo-commerce sites and they all work Perfect. Sweet!
Thank you!