NotifyComment

Logo WordPress

Cet article étant relatif au domaine informatique, je le rédige exceptionnellement en anglais afin qu’il soit accessible au plus grand nombre.

I realized recently that I was no more receiving automatic mails when a new comment was posted by a visitor on my WordPress powered site. After searching deeply on the internet I only found long threads with no conclusion, or links to chargeable plugins. Which was not very satisfying to my eyes as this feature had for sure been working in a recent past. If you end up on this page, the reason might be that you are also starting to scratch you head with this issue.

I was motivated enough to debug what was getting wrong in the WordPress code, although not being an expert in mail protocols.

I will save you too long readings, I head straight to the conclusion.

There is a file located in your wp-include directory named pluggable.php. This file contains functions that can be redeclared and overriden in a customization file named plugin.

The faulty function inside pluggable.php is wp_notify_postauthor(). I therefore simply defined a very simple plugin, adding to the code the missing part that makes it then behave like a charm. At least as once can expect. In short the message_headers variable has to be properly initialized instead of being set to a null string.

I tested it, it works nicely. The plugin is very light and only contains a single function (the overriden wp_notify_postauthor()) of a hundred lines. No risk of scrambling your overnightly worked blog.

You can donwload the file here. I named the plugin NotifyComment, and it comes as a zipped directory that you just need to unzip right on your server within your wp-content/plugins directory. You should end up with the file notify-comment.php located on your server under directory wp-content/plugins/wp-notify-comment/.

Once this is done, go to your plugin management interface, logged as admin, and activate the plugin listed under the name NotifyComment. That’s all it takes !

Now you will be notified for each new comment awaiting your moderation. Happy moderation then.