# Drafts, Pending and Scheduled in "At a Glance"

> Adds draft, pending and scheduled post counts to the At a Glance dashboard box, linked to the filtered lists.

- Type: PHP
- Runs: Admin only
- Category: [Dashboard](https://wpide.com/library/category/dashboard/)
- Tags: dashboard, at-a-glance, drafts
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/glance-drafts-pending-scheduled/

## Code

```php
add_filter( 'dashboard_glance_items', function ( $items ) {
    if ( ! current_user_can( 'edit_posts' ) ) {
        return $items;
    }

    $counts = wp_count_posts( 'post' );
    $labels = array(
        'draft'   => array( '%s Draft', '%s Drafts' ),
        'pending' => array( '%s Pending', '%s Pending' ),
        'future'  => array( '%s Scheduled', '%s Scheduled' ),
    );

    foreach ( $labels as $status => $forms ) {
        $count = isset( $counts->$status ) ? (int) $counts->$status : 0;

        if ( $count ) {
            $items[] = sprintf(
                '<a class="post-count" href="%1$s">%2$s</a>',
                esc_url( admin_url( 'edit.php?post_status=' . $status ) ),
                esc_html( sprintf( 1 === $count ? $forms[0] : $forms[1], number_format_i18n( $count ) ) )
            );
        }
    }

    return $items;
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Drafts, Pending and Scheduled in "At a Glance"" 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/
