WordPress Tips: Add comment links to administrator comment emails

» WordPress » WordPress Tips: Add comment links to administrator comment emails

Add a link to the comment page quickly in the WordPress webmaster's comment email, and reply to comments directly in the email

WordPress小技巧:给管理员评论邮件增加评论链接-极客公园

preface

discover problems

Before we talk again, let's take a look at WordPress's default webmaster comment email
WordPress小技巧:给管理员评论邮件增加评论链接-极客公园

First, let's talk about it. If you receive this comment email, you must first want to quickly reply to the visitor, right? But what are the connections WordPress gives us? ❓ ❓ ❓ All comments? Haven't I read my comments? Fixed connection? I don't know the content of my posts? Garbage comments and recycle bin? Comments on these two things will not appear here. I just want to reply to comments quickly. Since WordPress does not have a link to the background comment page, we can add one ourselves.

code

I checked the source code of WordPress and found that there is a filter to modify the content of this email /wp-includes/pluggable.php#L1593 There are some modifications. After a look, it should be customizable. Of course, we need to add content. The link of the background page is /wp-admin/edit-comments.php , just add this link.
Just put the following code into the theme function file function file [Git theme already contains this function, do not add it again]

 //Add comment link to webmaster comment email function git_notify_postauthor( $comment_id ) { $notify_message = $comment_id; $notify_message .= ' Quick reply to this comment: '. admin_url ('edit comments. php'); return $notify_message; } add_filter( 'comment_notification_text', 'git_notify_postauthor' );

Use effect

Look at the picture 💡
WordPress小技巧:给管理员评论邮件增加评论链接-极客公园

  • There is a link to enter the background comment page. Of course, if you enter from the email, you may need to log in for the first time.
  • This screenshot is just the first one. It's a bit long, isn't it...

Postscript

--End--

Post reply

Your email address will not be disclosed. Required items have been used * tagging

4 Replies to "WordPress Tips: Add comment links to administrator comment emails"