wordpress 评论邮件通知,邮件中的文章链接获取或错如何解决?

2021-03-12 13:10:30 +08:00
 tsxiaochen
comment_parent ? $comment->comment_parent : ''; $spam_confirmed = $comment->comment_approved; if (($parent_id != '') && ($spam_confirmed != 'spam')) { $wp_email = 'beyond0420@126.com' . preg_replace('#^www.#', '', strtolower($_SERVER['SERVER_NAME'])); //e-mail 发出点, no-reply 可改为可用的 e-mail. $to = trim(get_comment($parent_id)->comment_author_email); $subject = '[' . get_option("blogname") . '] 您的留言有了新回复'; $message = '

' . trim(get_comment($parent_id)->comment_author) . ', 您好!

您曾在《' . get_the_title($comment->comment_post_ID) . '》的留言:

' . trim(get_comment($parent_id)->comment_content) . '

' . trim($comment->comment_author) . ' 给您的回复:

' . trim($comment->comment_content) . '

点击查看

此邮件由系统自动发送,请勿回复

© ' . get_option('blogname') . '

'; $from = "From: \"" . get_option('blogname') . "\" <$wp_email>"; $headers = "$from\nContent-Type: text/html; charset=" . get_option('blog_charset') . "\n"; wp_mail( $to, $subject, $message, $headers ); } } add_action('comment_post', 'comment_mail_notify'); ?>

. htmlspecialchars(get_comment_link($parent_id)) .获取的文章链接错误,没有带栏目名称。 网站固定连接 /%category%/%post_id%.html 邮件中获取的链接为域名 /post_id.html

1056 次点击
所在节点    WordPress
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/761011

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX