Welchen Code soll ich verwenden, um den Betreff von Benachrichtigungs-E-Mails in einem WordPress-Blog anzupassen?WordPress: Betreff in neuen Kommentarbenachrichtigungs-E-Mails anpassen
Ich meine die E-Mails, die an Autoren gesendet werden, wenn ein Kommentar von jemandem auf seinem Post hinterlassen wurde.
Im Moment ist das Thema über:
[% site-Titel%] Kommentar: "% post-title%"
Ich mag würde zu verwenden:
Neuer Kommentar wartet auf dich
Aktuellen Code in functions.php
function comment_moderation_post_author_only($emails, $comment_id)
{
$comment = get_comment($comment_id);
$post = get_post($comment->comment_post_ID);
$user = get_userdata($post->post_author);
// Return only the post author if the author can modify.
if (user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email))
return array($user->user_email);
return $emails;
}
add_filter('comment_moderation_recipients', 'comment_moderation_post_author_only', 11, 2);
Frage @PierreLebedel aktualisiert wurde – baluba89
Die Antwort bleibt unverändert; Sie müssen diesen Code hinzufügen, zusätzlich zu dem, was Sie bereits in functions.php haben – Pierre
Fertig, aber ich bekomme immer noch das Standardthema. – baluba89