# Hide Commenter Email Addresses From Authors and Contributors

> Hides commenters' email addresses in the comment lists of the dashboard for users who are not moderators, so authors can reply to comments without seeing readers' personal email addresses.

- Type: PHP
- Runs: Admin only
- Category: [Privacy & Cookies](https://wpide.com/library/category/privacy/)
- Tags: comments, email, roles
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/privacy-hide-commenter-emails/

## Code

```php
add_filter( 'get_comment_author_email', function ( $email ) {
    return current_user_can( 'moderate_comments' ) ? $email : '';
}, 20 );
```

## Notes

Editors and administrators (users who can moderate comments) still see email addresses.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide Commenter Email Addresses From Authors and Contributors" 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/
