# "New Sign-Ups" View on the Users Screen

> Adds a "New this week" link next to All / Administrator / Subscriber on the Users screen that lists only people who registered in the last 7 days.

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

## Code

```php
// How many days count as "new".
$wpide_recent_days = 7;

add_filter( 'views_users', function ( $views ) use ( $wpide_recent_days ) {
    $query = new WP_User_Query( array(
        'fields'      => 'ID',
        'number'      => 1,
        'count_total' => true,
        'date_query'  => array( array( 'after' => $wpide_recent_days . ' days ago', 'inclusive' => true ) ),
    ) );

    $current = ! empty( $_GET['wpide_recent'] );

    $views['wpide_recent'] = sprintf(
        '<a href="%1$s"%2$s>New this week <span class="count">(%3$s)</span></a>',
        esc_url( add_query_arg( 'wpide_recent', 1, admin_url( 'users.php' ) ) ),
        $current ? ' class="current" aria-current="page"' : '',
        number_format_i18n( $query->get_total() )
    );

    return $views;
} );

add_action( 'pre_get_users', function ( $query ) use ( $wpide_recent_days ) {
    global $pagenow;

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

    $query->set( 'date_query', array( array( 'after' => $wpide_recent_days . ' days ago', 'inclusive' => true ) ) );
} );
```

## Notes

Change $wpide_recent_days to show a different period.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find ""New Sign-Ups" View on the Users Screen" 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/
