# Email Editors When a Post Is Submitted for Review

> Notifies editors and administrators by email when a contributor submits a post for review, with a link to edit it.

- Type: PHP
- Runs: Run everywhere
- Category: [Email](https://wpide.com/library/category/email/)
- Tags: email, editorial, notifications, workflow
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/email-notify-pending-review/

## Code

```php
add_action( 'transition_post_status', function ( $new_status, $old_status, $post ) {
    $roles = array( 'editor', 'administrator' ); // Roles that receive the email.

    if ( 'pending' !== $new_status || 'pending' === $old_status || wp_is_post_revision( $post ) ) {
        return;
    }

    $emails = get_users( array( 'role__in' => $roles, 'fields' => array( 'user_email' ) ) );
    $to     = wp_list_pluck( $emails, 'user_email' );

    if ( ! $to ) {
        return;
    }

    $author = get_the_author_meta( 'display_name', $post->post_author );

    wp_mail(
        $to,
        sprintf( 'Pending review: %s', wp_strip_all_tags( $post->post_title ) ),
        sprintf( "%s submitted \"%s\" for review.\n\nReview it here: %s\n", $author, wp_strip_all_tags( $post->post_title ), admin_url( 'post.php?post=' . $post->ID . '&action=edit' ) )
    );
}, 10, 3 );
```

## Notes

Change $roles to choose who is notified.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Email Editors When a Post Is Submitted for Review" 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/
