How to Add a Sortable User Registration Date Column in WordPress

Quick Summary
- Three filters, manage_users_columns, manage_users_custom_column and manage_users_sortable_columns, add a sortable Registration date column to the All Users screen.
- Cells show the user's registered date formatted with PHP's date function, and the header sorts with orderby=registered, which WordPress's user query already supports.
- Dates show in UTC, not your site's timezone, and an HTML-encoded arrow in wp_parse_args must become a plain => to avoid a parse error.
The All Users screen in the WordPress admin doesn’t show when each account was created. This snippet adds a Registration date column to the users table and makes it sortable, so you can list your newest or oldest users with one click.
Add the code to your child theme’s functions.php or to a small custom plugin.
/*
* Create a column. And maybe remove some of the default ones
* @param array $columns Array of all user table columns {column ID} => {column Name}
*/
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 the registration dates of the users
* @param string $row_output text/HTML output of a table cell
* @param string $column_id_attr column ID
* @param int $user user ID (in fact - table row ID)
*/
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:
}
return $row_output;
}
/*
* 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 );
}How it works
The snippet uses three filters of the users list table:
manage_users_columnsadds a column with the keyregistration_dateand the label “Registration date”. Uncomment theunset()line if you also want to remove a default column such as Posts.manage_users_custom_columnfills the cells. For theregistration_datecolumn it reads the user’sregisteredvalue withget_the_author_meta()and formats it with PHP’sdate(). All other columns keep their normal output.manage_users_sortable_columnsmakes the column header clickable and maps it toorderby=registered, a sort order the WordPress user query already supports.
Customize it
Change $date_format to any PHP date format. The default j M, Y H:i shows dates like 4 Feb, 2021 14:30. WordPress stores the registration time in UTC, so the time in the column is UTC too, not your site’s timezone.
After copying, check the wp_parse_args() line: the arrow between 'registration_date' and 'registered' must be a plain =>. If you see => there instead, replace it, otherwise PHP stops with a parse error.
The original tutorial on rudrastyh.com explains the code step by step: How to add a Sortable User Registration Date Column to the All Users page.
Related articles
- a Featured Image column for posts: the same column filters on the posts screen
- creating a custom user role: another way to organize the accounts on this screen
- custom CSS in the admin area: set the width of the new column

