# Last Post Date Column in the Users List

> Shows when each user last published a post, which makes inactive authors easy to find.

- Type: PHP
- Runs: Admin only
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: users, columns, authors
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/last-post-date-users-column/

## Code

```php
add_filter( 'manage_users_columns', function ( $columns ) {
    $columns['wpide_last_post'] = 'Last post';

    return $columns;
} );

add_filter( 'manage_users_custom_column', function ( $output, $column, $user_id ) {
    if ( 'wpide_last_post' !== $column ) {
        return $output;
    }

    $posts = get_posts( array(
        'author'        => $user_id,
        'numberposts'   => 1,
        'post_status'   => 'publish',
        'orderby'       => 'date',
        'no_found_rows' => true,
    ) );

    if ( ! $posts ) {
        return '&#8212;';
    }

    return sprintf(
        '<a href="%1$s">%2$s</a>',
        esc_url( get_permalink( $posts[0] ) ),
        esc_html( get_the_date( '', $posts[0] ) )
    );
}, 10, 3 );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Last Post Date Column 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/
