这意味着,当帖子A由User1编辑时,会在帖子A下出现一条新的注释,内容为“由User1编辑”,这样就可以很容易地看到帖子编辑的历史记录。此处还可以提供修订后的链接。
也许wp_new_comment会是一个更好的选择?
这意味着,当帖子A由User1编辑时,会在帖子A下出现一条新的注释,内容为“由User1编辑”,这样就可以很容易地看到帖子编辑的历史记录。此处还可以提供修订后的链接。
也许wp_new_comment会是一个更好的选择?
尝试在函数中使用以下代码。您的php文件child theme 主题
function add_comment_on_post_update( $post_id, $post_after, $post_before ) {
// If this is just a revision, don\'t send the email.
if ( wp_is_post_revision( $post_id ) )
return;
if (defined(\'DOING_AUTOSAVE\') && DOING_AUTOSAVE)
return;
if (isset($post_before->post_status) && \'auto-draft\' == $post_before->post_status) {
return;
}
if (\'post\' == $_POST[\'post_type\']) {
$current_user = wp_get_current_user();
$comment = \'Edited by \'.$current_user->user_login;
$time = current_time(\'mysql\');
$data = array(
\'comment_post_ID\' => $post_id,
\'comment_author\' => \'admin\',
\'comment_author_email\' => \'admin@admin.com\',
\'comment_author_url\' => \'http://www.xyz.com\',
\'comment_content\' => $comment,
\'user_id\' => $current_user->ID,
\'comment_date\' => $time,
\'comment_approved\' => 1,
\'comment_type\' => \'custom-comment-class\'
);
wp_insert_comment($data);
}
}
add_action( \'post_updated\', \'add_comment_on_post_update\', 10 , 3 );
向你问好,维诺德·达尔维<ul class=\"footer_banner_box_container clearfix\"> <div id=\"text-4\" class=\"widget widget_text\"> <h3 class=\"box_header\">Our Doctors</h3> <div class=\"textwidget\"> <h3