# Reply to Commenters From Moderation Emails

> Adds the commenter's email as the Reply-To of comment moderation emails, so you can answer or ask a question just by pressing Reply in your inbox.

- Type: PHP
- Runs: Run everywhere
- Category: [Email](https://wpide.com/library/category/email/)
- Tags: email, comments, reply-to
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/email-reply-to-commenter-moderation/

## Code

```php
add_filter( 'comment_moderation_headers', function ( $headers, $comment_id ) {
    $comment = get_comment( $comment_id );

    if ( ! $comment || ! is_email( $comment->comment_author_email ) || false !== stripos( (string) $headers, 'Reply-To:' ) ) {
        return $headers;
    }

    $name = trim( str_replace( array( '"', "\r", "\n", '<', '>' ), '', $comment->comment_author ) );

    return rtrim( (string) $headers, "\n" ) . "\nReply-To: " . ( $name ? '"' . $name . '" ' : '' ) . '<' . $comment->comment_author_email . ">\n";
}, 10, 2 );
```

## Notes

WordPress already does this for post author notifications; this adds it to the "please moderate" emails.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Reply to Commenters From Moderation Emails" 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/
