WordPress comments are very extensible feature of WordPress, since you cannot do very much with them by default. So how to extend them? There are few ways of doing this, so I’ll try to explain some of them. I will focus mainly on how to add some text into moderation and notification emails, or how to change them all.
First is by filters and actions. There are several filters and several actions regarding comments. I personally used "comment_moderation_text" and "comment_notification_text" to alter email text on newly posted comments. You can of course change whole text with these filters if you want.
Another way to play with comment notification and moderation emails is via pluggable functions. Their names are "wp_notify_postauthor" and "wp_notify_moderator". Both these functions are simple and just create an email content, subject and send it via wp_mail function. But be very careful overriding these pluggable functions, because in WP 2.2.3 you cannot override it in WP administration, and if you insert this function into some plugin of yours without if clause with "function_exists", there will be an PHP error.
Leave a Reply