Sorry, I probably didn’t explain that well enough.
WordPress has two comment-email related functions.
The first one, wp_notify_postauthor()
, emails a post author whenever a new comment is posted to one of the author’s posts.
The second one, wp_notify_moderator()
, emails the site admin and all users with the edit_comment
capability whenever a new comment has been submitted, but has been held in moderation and thus requires approval.
If WordPress sends a wp_notify_moderator()
email for a given comment, it will not send a wp_notify_postauthor()
email for that same comment.
Both of these functions are pluggable, which means that core has defined them as being able to be completely overwritten by Plugins.
The way my Plugin works is by overwriting the core-defined wp_notify_postauthor()
function. The only change I make to the core function is that instead of sending the email only to the post author, I define an array of email addresses (based on user configuration of the Plugin options) to which to send the email.
The problem with pluggable functions is that any Plugin can override the core function, and the first one to do so “wins”, so to speak. So if you have two Plugins that both try to override a pluggable core function, only one Plugin will actually be able to do so.
So, the more pluggable functions a Plugin defines, the more likely it is that another Plugin will be trying to override that same pluggable function.
The way the Plugin worked previously – and the reason that it worked in your case – was that it completely circumvented the core email functionality, and implemented its own. That wasn’t a very good implementation, and certainly not best practice. The current implementation is much better practice, because it plays more nicely with core and with other Plugins.
Long-term, it would be better not to have to override the entire function just to send the email to multiple email addresses. To that end, I’ve submitted a core patch to change the core wp_notify_postauthor()
function, to add a filter that would allow Plugins to add mail-to addresses without overwriting the entire function.
I’m waiting for core-dev input on the ticket. If it gets blessed, then I’ll submit a similar patch for wp_notify_moderator()
. And if that one gets approved, then I plan to add a setting to the Plugin, to send emails both for wp_notify_postauthor()
and for wp_notify_moderator()
.
Let me think about implementing it anyway. If you need that particular functionality, others may need it as well.