我做了很长一段路,在a related WordPress.org support thread:
add_action(\'comment_post\', \'notify_author_of_reply\', 10, 2);
function notify_author_of_reply($comment_id, $approved){
$comment = get_comment($comment_id);
$post_id = $comment->comment_post_ID;
$post = get_post($post_id);
if($approved && (get_post_type( $post_id )==\'ticket\')) {
$supervisor = get_userdata( get_post_meta($post->ID, \'assigned_by\', true) );
$operator = get_userdata( get_post_meta($post->ID, \'assigned_to\', true) );
$client = get_userdata( $post->post_author );
$recipients = array(
$client->user_email,
$supervisor->user_email,
$operator->user_email
);
$current_user = wp_get_current_user();
if (($key = array_search($current_user->user_email, $recipients)) !== false) {
unset($recipients[$key]);
}
wp_mail($recipients, \'New comment\', \'Dude you got a reply...\');
}
}