comment_notification_recipients
Filters the list of email addresses to receive a comment notification.
By default, only post authors are notified of comments. This filter allows others to be added.
Usage
add_filter( 'comment_notification_recipients', 'wp_kama_comment_notification_recipients_filter', 10, 2 ); /** * Function for `comment_notification_recipients` filter-hook. * * @param string[] $emails An array of email addresses to receive a comment notification. * @param string $comment_id The comment ID as a numeric string. * * @return string[] */ function wp_kama_comment_notification_recipients_filter( $emails, $comment_id ){ // filter... return $emails; }
- $emails(string[])
- An array of email addresses to receive a comment notification.
- $comment_id(string)
- The comment ID as a numeric string.
Changelog
Since 3.7.0 | Introduced. |
Where the hook is called
comment_notification_recipients
wp-includes/pluggable.php 1675
$emails = apply_filters( 'comment_notification_recipients', $emails, $comment->comment_ID );