# Recent Drafts From All Authors Widget

> Lists the latest drafts from every author on the dashboard, so editors can see what is in progress across the team.

- Type: PHP
- Runs: Admin only
- Category: [Dashboard](https://wpide.com/library/category/dashboard/)
- Tags: dashboard, widget, drafts
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/recent-drafts-all-authors-widget/

## Code

```php
// How many drafts to list.
$wpide_drafts_widget_count = 10;

add_action( 'wp_dashboard_setup', function () use ( $wpide_drafts_widget_count ) {
    if ( ! current_user_can( 'edit_others_posts' ) ) {
        return;
    }

    wp_add_dashboard_widget( 'wpide_team_drafts', 'Team Drafts', function () use ( $wpide_drafts_widget_count ) {
        $drafts = get_posts( array(
            'post_type'   => 'any',
            'post_status' => 'draft',
            'numberposts' => $wpide_drafts_widget_count,
            'orderby'     => 'modified',
        ) );

        if ( ! $drafts ) {
            echo '<p>No drafts right now.</p>';
            return;
        }

        echo '<ul>';
        foreach ( $drafts as $draft ) {
            $author = get_the_author_meta( 'display_name', $draft->post_author );
            printf(
                '<li><a href="%1$s">%2$s</a> <span style="color:#646970">by %3$s, %4$s ago</span></li>',
                esc_url( get_edit_post_link( $draft->ID ) ),
                esc_html( get_the_title( $draft ) ? get_the_title( $draft ) : '(no title)' ),
                esc_html( $author ),
                esc_html( human_time_diff( get_post_modified_time( 'U', true, $draft ), time() ) )
            );
        }
        echo '</ul>';
    } );
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Recent Drafts From All Authors Widget" 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/
