# Show the Newest Users First in the Users List

> Sorts the Users screen by registration date with the newest accounts on top by default, so new sign-ups are easy to review.

- Type: PHP
- Runs: Admin only
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: users, admin, sorting
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/users-list-newest-first/

## Code

```php
add_action( 'pre_get_users', function ( $query ) {
    global $pagenow;

    if ( 'users.php' !== $pagenow || ! empty( $_GET['orderby'] ) || $query->get( 'fields' ) === 'ID' ) {
        return;
    }

    $query->set( 'orderby', 'registered' );
    $query->set( 'order', 'DESC' );
} );
```

## Notes

Clicking a column header still sorts by that column.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Show the Newest Users First in the Users List" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
