I’m always massively disappointed when I comment on a FANTASTIC blog post, just to find out they don’t email me when they reply to my comment.
- I LIKE starting a conversation.
- I LIKE seeing how you respond to my comment.
- I LIKE being able to chat with you.
Please help this all happen!
One simple plugin can increase your conversations tenfold.
Install it, use it, love it.
I consider this to be a MUST HAVE plugin for every single WordPress blog.
Don’t freak out when you see the big yellow, “This plugin hasnβt been updated in over 2 years.” message on the WordPress page. Yes, it hasn’t been updated. But no, it does not actually NEED to be updated. Some plugins are so ridiculously simple that they don’t even need updates. This is one of those.
Don’t believe me? Let’s break down the code.
Coding your own comment reply notification plugin! (It’s seriously easy.)
Here’s where I confess to you that I don’t use Comment Reply Notification. I used to, but I stopped. But the only reason I stopped was because I wanted more control over the email I was sending and wanted to send via Mandrill. That’s not going to apply for like 99% of people.
But I think the fact that I took the time to code this thing myself shows how insanely easy the code is. I got a lot of it from the Comment Reply Notification plugin, so yes, that code is still relevant. It still works. It doesn’t need to be updated.
Allow me to talk you through my code.
class NG_Comment_Reply { /** * Constructor function * * Adds the actions we need * * @access public * @since 2.1 * @return void */ public function __construct() { add_action( 'wp_insert_comment', array( $this, 'comment_notification' ), 99, 2 ); add_action( 'wp_set_comment_status', array( $this, 'comment_status_changed' ), 99, 2 ); } /** * When a comment gets published, this checks to see if an email should * be sent. If so, it fires the email function. * * @param int $comment_id * @param object $comment_object * * @uses send_email() * @access public * @since 2.1 * @return void */ public function comment_notification( $comment_id, $comment_object ) { // This comment is not approved or it's not a reply to a parent comment -- bail. if ( $comment_object->comment_approved != 1 || $comment_object->comment_parent < 1 ) { return; } $comment_parent = get_comment( $comment_object->comment_parent ); // If someone is replying to themselves, don't send an email. if ( $comment_parent->comment_author_email == $comment_object->comment_author_email ) { return; } // Let's send the email in all other scenarios. $this->send_email( $comment_id, $comment_object, $comment_parent ); } /** * Triggers when the status of a comment gets changed (like if we approve * it later). This also determines if an email should be sent, and if so, * it calls our comment_notification() method. * * @param int $comment_id * @param string $comment_status * * @uses comment_notification() * @access public * @since 2.1 * @return void */ public function comment_status_changed( $comment_id, $comment_status ) { $comment_object = get_comment( $comment_id ); if ( $comment_status == 'approve' ) { $this->comment_notification( $comment_object->comment_ID, $comment_object ); } } /** * Crafts the comment reply message and sends the email. * * @param int $comment_id * @param object $comment_object * @param object $comment_parent * * @uses Transactional_Message * @access public * @since 2.1 * @return void */ public function send_email( $comment_id, $comment_object, $comment_parent ) { $recipient = $comment_parent->comment_author_email; $subject = 'Hey, there\'s a reply to your comment on Nose Graze!'; ob_start(); ?> <p>Hey there, hot stuff! There's a new reply to your comment over on Nose Graze. As a reminder, here's your original comment on the post <a href="<?php echo get_permalink( $comment_parent->comment_post_ID ); ?>"><?php echo get_the_title( $comment_parent->comment_post_ID ); ?></a>: </p> <blockquote><?php echo $comment_parent->comment_content; ?></blockquote> <p>And here's the new reply from <strong><?php echo $comment_object->comment_author; ?></strong>:</p> <blockquote><?php echo $comment_object->comment_content; ?></blockquote> <p>You can read and reply to the comment here: <a href="<?php echo get_comment_link( $comment_object ); ?>"><?php echo get_comment_link( $comment_object ); ?></a> </p> <p>Let's keep the conversation going!</p> <?php $message = ob_get_clean(); new Transactional_Message( $recipient, $subject, $message, 'comment-reply' ); } } new NG_Comment_Reply();
My code is pretty heavily commented if you want to follow it. There’s one thing I’ll mention that won’t work out of the box, and that’s in the send_email()
method.
Towards the end I have this line:
new Transactional_Message( $recipient, $subject, $message, 'comment-reply' );
That’s because I have another class called Transactional_Message
that I use as a wrapper for all my Mandrill emails. For a more typical WordPress set up, you’d want something like:
$headers = array('Content-Type: text/html; charset=UTF-8'); wp_mail( $recipient, $subject, $message, $headers );
That uses the built-in WordPress mailer function.
Let your readers know you’ve replied. They’ll LOVE IT!
I often see people complaining about bloggers never replying to their comments. They feel ignored. They feel like they don’t matter.
Well here’s the thing, if you don’t have a way of notifying your readers that you’ve replied, then for all they know, maybe you didn’t reply! Most people have better things to do than regularly check back to every single post they ever commented on to see if the blogger replied.
You need to let them know.
Whether you use Comment Reply Notification, my plugin, or some other plugin, have something that will let your readers know how you’ve responded. That’s the way to keep up comments and interaction on your blog!
I find it very frustrating when sites don’t have this. I comment on their site and never hear back. I assume they’re not responding to my comment.
I think I have subscribe to comments, will that work too or should I have both?
Which is a plug in.
You should test to see how it works exactly.
-> People do not want to be emailed about EVERY COMMENT (like if it’s not necessarily a reply to theirs). Or, at least, they don’t want that to be their only choice.
-> If they have the option of subscribing to REPLIES to their comment, that’s perfect!
Just make sure it’s clear. π
I believe it auto subscribes to replies. I have tested it and I don’t get emails if someone ELSE replies. Maybe I will again though.
Yes yes YES!!!!!!! (how many exclamation points can I use before it gets weird? LOL)
If someone’s blog doesn’t send email notifications of replies to comments, they might as well not bother replying, cause no one will ever know.
I JUST installed this yesterday, and while I haven’t made my website live or linked it to my previous one as of yet, I can’t wait to use this, and YES, conversations with new people are the best! <3
I love Comment Reply Notification, both as a commenter and as a blogger. But a very small percentage of the blogs I visit actually have it, and I wonder why. Is it only available for self-hosted WordPress?
This particular plugin is only on self-hosted WordPress. I think there’s a slightly less good/convenient option on WordPress.com but I’m not totally sure.
I wish this option was mandatory in all WordPress websites. I am forgetful and often forget to come back and check if someone replied. I love getting notification.
I have Comment Reply Notification plugin installed from day one, mainly because I followed your awesome tutorial for transferring to WordPress. π
I always try to reply to every comments and I love to chat with my followers. Glad to see I’m not the only one who likes to know someone responded to my blog comments! I believe I have this plugin, but I will make sure just in case I don’t <3 Thanks!
This was super helpful thank you! I added the plug-in to my blog. I was wondering why people never came back and discussed with me… I thought they were notified anyways… Now I know I was wrong. Thanks for the helpful tip!
One of the big reasons for me moving to wordpress was this plug-in. I love being able to start a conversation with my commenters.
Done! π
Thank you Ashley. I hate it when I have to get every comment through just to see the replies π I’m actually writing an article for Monday, “My Top Ten Favourite NoseGraze Articles” and this one will definitely be going on there π I hope you don’t mind, your blog is just filled with awesomeness lol π
Amy x
OMG that’s so awesome Amy! You have to send me a link when it’s up so I can check it out. π
π awesome. I’m not sure if you’ll be able to view it until Monday, but here’s the link:
http://www.anovelstart.com/my-top-16-favourite-kick-ass-nosegraze-articles
Thanks for the tip! I never even knew this was an option!
You’re welcome! π
A while back I was going through your post “All the WordPress Plugins I Use for Blogging” and saw that you listed this plug-in. So I installed it and I absolutely love it! Thank you for always posting such helpful information!
You’re so welcome, Jen!
Thank you so much for this – I never would have downloaded a plugin that hadn’t been updated for 5 years but I’d never thought that some may not have needed updating. I’m looking forward to seeing the results of using this plugin. Thank you again. xo
There are some plugins that are literally like 3 lines of code. As long as the WordPress feature they’re based off of doesn’t change, then there’s literally nothing to change about the plugin. Even if the owner wanted to, there’s just nothing to update.
That’s the case with this plugin. This one is more than 3 lines of code, but it gets triggered in two scenarios:
1) When a new comment is posted.
2) When a comment’s status gets changed from something to approved (like if it was submitted, marked as pending, then the admin approved it).
Neither of those things have fundamentally changed in WordPress.
Similarly, the action that happens when those two things occur (the sending of an email) is based on the WordPress “send an email” feature. That also hasn’t changed in many many years.
The smaller and more generic a plugin is, the less likely it’s ever going to need updating. π
The only times a plugin REALLY needs to be updated are:
1) WordPress deprecates (removes) a function/feature. This doesn’t happen that often.
2) WordPress fundamentally changes how something works. This also doesn’t happen that often.
3) There’s a security flaw. This typically only happens with bigger, more “intrusive” plugins.
This one is pretty basic and uses functionality that’s been around in WordPress (and unchanged) for years and years. π
Disqus does this automatically. It’s a nice feature to have. I like disqus because I’ve had issues with WP comment notifications in the past.
Quick question, Ashley – do you know if this also works if the post author is the one who made a comment? I downloaded the plugin and tried to do a test comment + reply, but half an hour later, the email still hasn’t showed up in my inbox. Not quite sure whether that’s something I should be worried about or just a normal part of the plugin…
Yep it will work as long as the person replying to the comment isn’t the same person who made the comment.
You do need to make sure you actually turn the plugin on though. I think a lot of people assume they can just install it, activate it, and it will work. But it actually has a settings panel where you need to turn on the comment notifications.
Ashley,
Thank you for the great Comment Reply feature. Could you tell me how to install into WP site?
Thank You!
Simply go to Plugins > Add New in WordPress and search for “Comment Reply Notification”. Then click “Install”. π
I must confess I thought this feature of reply notifications was automatic – didn’t know it required a plugin. I’m installing the plugin right now. Thanks for this great tip!
You’re welcome Rosa! π
Does the original commenter have to click a link in their email account to confirm that they want to receive the replies? Using the one in Jetpack (I believe it is), they have to confirm, and if you reply before they have clicked this, they won’t get your reply.
Nope – it happens automatically. π No confirmation needed.
That’s wonderful! Thanks for your reply. π
Thanks for this useful article. At first I tried Comment Reply Notification plugin but it seems it is not updated and drives has_cap() error, so I ignored it; but I’m interested to know how can I use your customized code? And how can I integrate your code with sendgrid?
Thanks for this post, Ashley! Implemented the code on my own website, this is great! Maybe people will reply to my replies now. π
Hiya…I’ve actually tried to set this up. It seems like I have this set up correctly, but when I test it by leaving a comment as a guest visitor to the site and then respond as the site administrator it’s not actually sending out the email notification. I’m not sure what to do here. Seems like an awesome plugin. Any advise? Thanks in advance!
Hi Tammy,
If you have the settings configured correctly but you’re not getting emails, then it suggests a problem with your server or domain name settings.
SPF records with your domain not set up correctly.
Your server’s IP has been blacklisted by your mail provider.
etc.
Those are the kinds of things that help ensure email delivery from your server. Without those things, your email provider could be refusing to accept any emails from your site.
Thank you for sharing this tip Ashley, I will definitely give it a try!
Hello Ashley, thats codes work on wordpress 4.6.1 ? Other question how to translate Turkish lang?
is there any reason to cause the notification doesn’t work ?
the plugin i have installed and activated it as well.
my wordprss website can send emails without problem.
but i still can’t receive the notification email after activating that plugin.
any idea about this ?
thank you so much for awesome article
Thank you for sharing this information. Hopefully this will work.
Hi there, still helps in 2018! Thanks.
Best, M
Hi Ashley,
visitors’ liking or displaying a website encourages comments. π
Is it possible to use the code you mentioned in another system, except WordPress?