Notify Moderators when Comment Removed from Spam


WordPress can be configured to send out a notification email to moderators when a comment is held for moderation. One thing I've noticed, however, is that if a legitimate comment is incorrectly marked as spam, manually marking it as "not spam" does not trigger the notification email to be send to moderators. That means if you manage WordPress comments via email or a helpdesk system (such as HelpScout), you won't receive notification of the comment in your inbox, even after removing it from your spam folder.

To correct this, you can use the following PHP code (e.g. in your functions.php file) to notify moderators when a comment has been marked as "not spam":

add_action('comment_spam_to_unapproved', 'dbc_notify_moderator_on_comment_spam_to_unapproved');

function dbc_notify_moderator_on_comment_spam_to_unapproved($comment) {
	if (!isset($comment->comment_ID)) { return; }


Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.

We may earn a commission when you visit links on our website.