Add a Sortable Registration Date Column to the Users Page

WordPress doesn't offer any option to sort WordPress registered users by a sortable user Registration date column on the All Users page. However, it helps you see the date a user gets registered on your site. So, it's really very useful, especially when you want to manage or delete spam users.

In this knowledgebase article, we'll show you how easily you can add a sortable user Registration date column to the All Users page.

Let's get started!

Add a Sortable User Registration Date Column

You can easily add a sortable user registration date column to the All Users page.

Simply go to the left sidebar of the WordPress admin dashboard, navigate to Appearance, and click Theme File Editor.

The Theme File Editor screen will open up. Now add the following code snippet into your current themes’ functions.php file, and it will work fine.

/*
 * 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 );
}

Once you add the following code in the theme’s functions.php file, the default Posts column will be replaced with the Registration date column. Upon clicking its title, the users in this table will be sorted by registration date. 

Registration date column

That’s it! Easy right? We hope you will understand how easily you can add a sortable user Registration date column to the All Users page.

If you have any doubts or questions related to this matter, please don’t hesitate to contact our support team.

Still stuck? How can we help?

Updated on January 16, 2024

Documentation
triangular shape yellowish icon

Frequently Asked Questions (FAQs)

These FAQs answer the most common questions about our WordPress custom login page plugin.

three shapes icon

Where can I get support for LoginPress?

If you need help with LoginPress, you can contact us here. We’ll be happy to answer any questions about the plugin.

Do you have an affiliate program?

Yes, we have an affiliate program that you can sign up for here. As an affiliate, you’ll earn a commission on every sale you refer to us.

Do you offer refunds?

Yes, we offer a 14-day money-back guarantee on all of our plans. If you’re unsatisfied with LoginPress, simply contact us within 14 days of your purchase, and we’ll process a refund.

Can I upgrade my license after my initial purchase?

Yes, you can upgrade your LoginPress license at any time. Simply log into your account and go to the My Downloads page. From here, you can upgrade your license and download the latest version of the plugin.

Will LoginPress slow down my website?

No, LoginPress will not slow down your website. The plugin is lightweight and only loads the necessary files when someone tries to access your login page.

three shapes icon

If you Still have Questions?

Get In Touch