I’ve added mailing triggers to wp_notify_postauthor and wp_notify_moderator to know when each one is called.
I create test user with role of author.
I author test post by that user.
I post anonymous comment on that post.
I should receive an email to the admin/moderation account triggered by wp_notify_moderator and one to the test user triggered by wp_notify_postauthor.
I receive emails to both admin and author triggered by wp_notify_moderator. I can’t get the wp_notify_postauthor to fire.
Do I misunderstand the expected behavior of these functions? I really want to turn off author notifications, so I thought I could just redefine wp_notify_postauthor to return true but it doesn’t seem to work.
So after further digging, it seems I was wrong about my expectations. It seems ( around line 1400 in wp_includes/comment.php) that wp_notify_postauthor is only triggered when the comment is a approved.
So why, then, is the post author being notified by wp_notify_moderator? Shouldn’t this function only notify the moderator and not the author?