How to Make Disqus Notify the Post Author When a New Comment Is Posted?

This is an interesting one. A new client is using the Disqus service to replace the default WordPress commenting system within their website. They noticed that post authors weren’t receiving notification emails when a new comment was added to their post.

After a bit of searching, I found the following blog post which confirms the issue and provides a simple workaround for it. Normally I’d never alter the code within a plugin (as it makes future updates a nightmare) but in this case, the pros outweigh the cons.

Update: 30 July 2014

As jeremyclarke pointed out, these days, rather than editing the Disqus plugin itself (which is a cardinal sin and should never be done) I would simply create a snippet, that hooks into the wp_insert_comment action or similar, and add it into my functions.php file or a custom plugin. Something along the lines of…

add_action( 'wp_insert_comment', 'disqus_notify_postauthor', 99, 2);

function disqus_notify_postauthor( $comment_id, $comment_object ) {
	wp_notify_postauthor( $comment_id );

4 replies on “How to Make Disqus Notify the Post Author When a New Comment Is Posted?”

FWIW you could work out a filter-based solution by filtering updates to update_comment_meta() when the id is ‘dsq_post_id’ and running wp_notify_postauthor() at that point. Haven’t done it yet (gonna be a PTA to test properly ’cause Disqus chokes on local dev environments) but there’s no reason it wouldn’t work.

Thanks. Yes, these days (this post was submitted in 2011) I’d probably hook into the wp_insert_comment action and trigger the wp_notify_postauthor function from there.

Leave a Reply

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