Hey,
You can read the source code of wp_notify_postauthor function on this link https://developer.wordpress.org/reference/functions/wp_notify_postauthor/#source
Click on Expand full source code or View on Trac/Github.
$notify_message hold the message for the email in plain text format. You can modify this text message using the Hook https://developer.wordpress.org/reference/hooks/comment_notification_text/
You can read about filter hooks and how to use them here https://developer.wordpress.org/plugins/hooks/filters/
Best
Vijay
Hello @vijayhardaha
I would like to add a small logo with a link at the footer of the wordpress email template
add_filter('comment_notification_text',
function ($notify_message){
$notify_message .= '<a href="https://example.com/">
<img alt="example" src="http://example.me/wp-content/uploads/2022/02/k.png" width="64" height="64">/a>';
return $notify_message;
}
);
the email template displays this HMTL code at the bottom
<a href="https://example.com/">
<img alt ="example" src="http://example.me/wp-content/uploads/2022/02/E.png" width="64" height="64">/a>
What should I do to display the image not the code? Thank you!
Hey @globsticks,
Most of these kinds of core emails are plain text emails and you’re trying to add HTML in plain text.
if you need HTML in emails then you’ll have to set HTML content type in email headers using the hook.
https://developer.wordpress.org/reference/hooks/comment_notification_headers/
you can perform replace for text/plain with text/html to get this done.
Best
Vijay