我有自定义的帖子类型“艺术大师”。每篇文章都是主人的简介。
在他们的个人资料中,设置了自定义域名称“master\\u email”。我需要发送主电子邮件通知,如果每次发布新的评论。
如何调用post new comment函数以使用wp\\u mail?谢谢你的帮助!
我有自定义的帖子类型“艺术大师”。每篇文章都是主人的简介。
在他们的个人资料中,设置了自定义域名称“master\\u email”。我需要发送主电子邮件通知,如果每次发布新的评论。
如何调用post new comment函数以使用wp\\u mail?谢谢你的帮助!
您可以在函数中尝试类似的操作。php
function send_comment_email_notification( $comment_ID, $commentdata ) {
$comment = get_comment( $comment_id );
$postid = $comment->comment_post_ID;
$master_email = get_post_meta( $postid, \'master_email\', true);
if( isset( $master_email ) && is_email( $master_email ) ) {
$message = \'New comment on <a href="\' . get_permalink( $postid ) . \'">\' . get_the_title( $postid ) . \'</a>\';
add_filter( \'wp_mail_content_type\', create_function( \'\', \'return "text/html";\' ) );
wp_mail( $master_email, \'New Comment\', $message );
}
}
add_action( \'comment_post\', \'send_comment_email_notification\', 11, 2 );
你可以试试这个。示例:helenyhou@example.com
add_filter(\'wp_mail_from\',\'yoursite_wp_mail_from\');
function yoursite_wp_mail_from($content_type) {
return \'helenyhou@example.com\';
}
add_filter(\'wp_mail_from_name\',\'yoursite_wp_mail_from_name\');
function yoursite_wp_mail_from_name($name) {
return \'Helen Hou-Sandi\';
}
今天我在研究wordpress的评论。I am looking for making a Comment Type 我可以用它来评论我用于商业目录列表的wordpress自定义帖子类型。查看wordpress的wp\\U comments表,这里是表字段。请填写每个表格字段的用途(查看10、12、13):comment_ID: 评论IDcomment_post_ID: 发表评论的帖子comment_author: 评论作者姓名comment_author_email: 评论作者姓名comment_auth