最后更新于2 天前。
本次更新为前台撰写页新增审核提醒邮件。
作者或编辑提交文章进入审核箱后,系统会自动向站点管理员邮箱发送提醒,邮件中包含文章标题、作者、提交时间和后台审核入口。
管理员提交文章仍会直接发布,不触发审核提醒。
修改源码
if ($post_status === 'publish') {
$link = get_permalink($post_id);
self::set_notice('success', '文章已发布。<a href="' . esc_url($link) . '">查看文章</a>');
return array(
'writer_status' => 'published',
'post_id' => $post_id,
);
} else {
self::send_pending_post_notification($post_id);
self::set_notice('success', '文章已提交审核,管理员审核后会公开显示。');
return array('writer_status' => 'pending');
}
private static function send_pending_post_notification($post_id) {
$post = get_post($post_id);
if (!$post || $post->post_type !== 'post' || $post->post_status !== 'pending') {
return false;
}
// The review reminder is informational only; a failed email must not block the saved pending post.
$subject = '有新文章等待审核 - ' . wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
return self::send_html_mail(get_option('admin_email'), $subject, $message, 'pending_post_review');
}