Optimization of WordPress comment reply notifications

in most cases,We are accustomed to using the built-in WordPress commenting system,Although it's not intended to make people - after all,,Third-party commenting system it is difficult to accept。

Relatively good third party to say it is disgusting;The foreign system several good reviews and very inconvenient to use China,In general,Or WordPress comment system comes with the best。

Then,Speaking WordPress comes with this comment system,E-mail notification may be its most important characteristic of the。Although Externally WordPress will not comment publicly on those e-mail address,But you would never think someone would use to notify the proliferation of spam comments it!

Background - Settings - discussions,Check”Comments must be approved by artificial”,All such comments must be reviewed by an administrator to display。

I just need to reply to any comments WordPress site can be friends! and so,We need to stop this behavior,The easiest way is to open only after a review by the audit rather than directly through。Other,We also need to customize the look WordPress comes with e-mail notification function,It smarter - such as other people's comments when someone comments,Only reviewed by the e-mail notification will be issued。

Same,I recommend that you make changes in the sub-theme,So your subject can freely upgrade to avoid self-defined content is cleared out:)

In your current theme functions.php Append the following:


Ok,Now that we have changed the default e-mail notification function,Why not change the way some of the more radical,It looks more pleasing that? In short,I just found some code online beautification,of course,The old code is not run properly,I am referring to the pandanus blog's code of minor modifications,You can take a try:)


At last,Let's look at the results:

After a review landscaping reply mail notification

After a review landscaping reply mail notification

Original article written by Gerber drop-off:R0uter's Blog » Optimization of WordPress comment reply notifications

Reproduced Please keep the source and description link:https://www.logcg.com/archives/1638.html

About the Author


The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。


    1. Try to use third-party e-mail service,smtp,If your server does not support e-mail,In any case you are unable to go,Service providers need to send work orders to seek further support。

  1. I changed the topic under….Dark colors do not like n

    * Repair WordPress Comments Reply Mail notification malicious use problems logcg.com drop off Gerber
    * Secondary modify mikifuns blog.mikifuns.com
    function logcg_comment_mail_notify($comment_id, $comment_status) {
    // Comments must be sent via e-mail notification will be reviewed
    if ($comment_status !== ‘approve’ && $comment_status !== 1)

    $comment = get_comment($comment_id);

    if ($comment->comment_parent != ‘0’) {
    $parent_comment = get_comment($comment->comment_parent);

    // Mail Recipient email
    $to = trim($parent_comment->comment_author_email);

    // mail title
    $subject = 'You[‘ . get_option(“blog names”) . ‘]With the new reply message ';

    // content of email,Amend its own,Support HTML
    $message = ‘

    You ‘ . get_option("Blogname") . ‘ With the new message reply!

    ‘ . $parent_comment->comment_author . ‘,Hello!
    You had [‘ . get_option(“blog names”) . ‘] Articles
    《’ . get_the_title($comment->comment_post_ID) . Comment '' on the:
    ‘ . nl2br($parent_comment->comment_content) . ‘
    ‘ . trim($comment->comment_author) . ‘ Give your reply below:
    ‘ . nl2br($comment->comment_content) . ‘

    comment_parent)) . ‘” target=”_self” style=”text-decoration: none;”> Click to view

    Welcome again ‘ . get_option("Blogname") . ‘
    (This message is automatically issued by the system, Please do not reply directly。)


    $message_headers = “Content-Type: text/html; charset=””.get_option(‘blog_charset’).”\”\n”;

    // Do not fill to email comments and send an email alert administrators
    if($to != ” && $to != get_bloginfo('ADMIN_EMAIL'))
    @wp_mail($to, $subject, $message, $message_headers);

    // Edit and administrators reply directly send reminder emails,Because editors and administrators do not need to review comments
    add_action(‘comment_post’, ‘logcg_comment_mail_notify’, 20, 2);

    // Regular visitor comments,Bloggers and other review before sending an email alert
    add_action(‘wp_set_comment_status’, ‘logcg_comment_mail_notify’, 20, 2);

    1. You need to enable ssl encryption,465 port also changed encrypted like,I did not remember hehe,If gmail, then remember to use one-time password,Do not open or step verification。There is chaos filled sender mailbox can not,Your account must be consistent with the job。

          1. I also tried the Post Tencent enterprise the same error,2016-03-29 13:58:05 SERVER -> CLIENT: 221 Bye
            2016-03-29 13:58:05 Connection: closed
            2016-03-29 13:58:05 SMTP Error: Could not authenticate.
            From Email

Leave a Reply

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