您可以将此代码复制到插件中,激活后会将所有评论转换为帖子,并删除评论(这样您就不会有重复的评论)
您还可以使用get\\u comments(http://codex.wordpress.org/Function_Reference/get_comments )
register_activation_hook( __FILE__, \'wpse_29474_convert_to_posts\' );
function wpse_29474_convert_to_posts(){
$comments = get_comments();
foreach($comments as $comment)
{
$post=get_post($comment->comment_post_ID);
$title=sprintf("Comment on %s by %s",$post->post_title,$comment->comment_author);
$content=$comment->comment_content;
$my_post = array(
\'post_title\' => $title,
\'post_content\' => $content,
\'post_status\' => \'publish\',
\'post_author\' => 1
);
wp_insert_post( $my_post );
wp_delete_comment( $comment->comment_ID );
}
}