Notify Moderators when Comment Removed from Spam

This post may contain referral links which may earn a commission for this site

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; }
	wp_notify_moderator($comment->comment_ID);
}

More Divi Tips

Hundreds of new features for Divi
in one easy-to-use plugin

0 Comments

Submit a Comment

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