Change the WordPress Message

The notifications of WordPress for the author of an article or comments are not always right on the spot according to the needs. WordPress also knew that and created these functions so that it's easy to adapt notifications to your needs or can completely be replaced. Therefore, I will briefly show how to adjust the mails to your needs.

The two functions wp_notify_postauthor() and wp_notify_moderator() are used to send messages, but can be replaced. You can find these two functions in wp-includes/pluggable.php and there are all the functions included, which WordPress queries (if ( !function_exists('set_current_user') )), so that you can replace it easily. Therefore, it is a simple task to adjust the notifications in your WordPress installation.

wp-mail

In order to realize this, the function must be placed as a Plugin or in the functions.php of the themes. Thus they are available and are used by WP. The easiest way is to copy the two functions and adapt the content.

function wp_notify_postauthor($comment_id, $comment_type='') {
    ...
}
function wp_notify_moderator($comment_id) {
    ...
}

For example, it is easy not to have the URL to delete the comment in the mail, but a link. Again, a small example. The standard line, as in the screenshot above, is as follows:

$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";

We replace this with a little HTML, and so we have a link in the email.

$notify_message .= sprintf( '<a href="%s">' . __('Delete it') . '</a>', get_option('siteurl') . "/wp-admin/comment.php?action=cdc&c=$comment_id"  . "\r\n" );

This should only serve as an example and plain text messages are sure to be preferred. Nevertheless, there are always demands to adapt the mail; the function wp_mail() is flexible enough and the contents of the mail can be replaced by the two functions and separated from the core, so you are independent from any update.