# Remind Authors About Old Drafts

> Once a week, emails each author a list of their drafts that have not been touched for a month, with edit links, so good ideas do not get forgotten.

- Type: PHP
- Runs: Run everywhere
- Category: [Email](https://wpide.com/library/category/email/)
- Tags: email, editorial, authors
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/email-stale-drafts-reminder/

## Code

```php
$wpide_stale_days = 30;

add_action( 'init', function () {
    if ( ! wp_next_scheduled( 'wpide_stale_drafts' ) ) {
        wp_schedule_event( time() + DAY_IN_SECONDS, 'weekly', 'wpide_stale_drafts' );
    }
} );

add_action( 'wpide_stale_drafts', function () use ( $wpide_stale_days ) {
    $drafts = get_posts( array(
        'post_type'     => 'post',
        'post_status'   => 'draft',
        'numberposts'   => 300,
        'no_found_rows' => true,
        'date_query'    => array( array( 'before' => gmdate( 'Y-m-d H:i:s', time() - $wpide_stale_days * DAY_IN_SECONDS ), 'column' => 'post_modified_gmt' ) ),
    ) );

    $by_author = array();
    foreach ( $drafts as $draft ) {
        $by_author[ (int) $draft->post_author ][] = $draft;
    }

    foreach ( $by_author as $author_id => $posts ) {
        $user = get_userdata( $author_id );
        if ( ! $user || ! is_email( $user->user_email ) ) {
            continue;
        }

        $lines = array( sprintf( 'Hi %s, these drafts have not been edited for over %d days:', $user->display_name, $wpide_stale_days ), '' );
        foreach ( array_slice( $posts, 0, 20 ) as $post ) {
            $lines[] = sprintf( '• %s – %s', $post->post_title ? $post->post_title : '(no title)', admin_url( 'post.php?post=' . $post->ID . '&action=edit' ) );
        }
        $lines[] = '';
        $lines[] = 'Finish them, schedule them or move them to the trash.';

        wp_mail( $user->user_email, 'Your drafts are waiting', implode( "\n", $lines ) );
    }
} );
```

## Notes

Change the number of days at the top; each author gets at most one email per week listing up to 20 drafts.

## How to use it

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