My question is "How to send comment notification to website admin and also post Author?"... In Wordpress default function is "Post author received a comment notification message when user add any comments" but my requirement is totally different. In post - Post Author and website admin only comment (communicate) each other. As per WordPress default notification, Post Auther received the notification but when Auther reply or any comments on the post - Website Admin not received any notification messages.
I am using functions.php
and my code is,
function se_comment_moderation_recipients( $emails, $comment_id ) {
$emails = array( get_option( 'admin_email' ) );
return $emails;
}
add_filter( 'comment_moderation_recipients', 'se_comment_moderation_recipients', 11, 2 );
add_filter( 'comment_notification_recipients', 'se_comment_moderation_recipients', 11, 2 );
As per my above code, Admin only received but I need If admin reply any comments to post, that particular author received some notification message - If Post author reply or comments any, admin received an alert message.
I am using Multiple user comment notification, this below code is almost covered my requirement.
add_filter('comment_notification_recipients', 'override_comment_notice_repicient', 10, 2);
function override_comment_notice_repicient($emails, $comment_id) {
$admins = get_users( array(
'role__in' => array('administrator'),
) );
foreach ( $admins as $user ) {
$emails[] = $user->user_email;
}
return ($emails);
}
Above code is from this link