我正在尝试将facebook评论导入WordPress,我所做的是获取facebook帖子的图表,json解码,然后通过此代码导入评论
到目前为止,我的代码是
foreach($comm_no as $answer_id => $v) {
$time = current_time(\'mysql\');
$data = array(
\'comment_post_ID\' => $post->ID,
\'comment_author\' => $v->from->name,
\'comment_author_email\' => \'\',
\'comment_author_url\' => \'https://www.facebook.com/\'.$v->from->id,
\'comment_content\' => $v->message,
\'comment_type\' => \'\',
\'comment_parent\' => 0,
\'user_id\' => 5,
\'comment_author_IP\' => \'127.0.0.1\',
\'comment_agent\' => \'egysp.com\',
\'comment_date\' => $time,
\'comment_approved\' => 1,
);
wp_insert_comment($data);`
这段代码在我的单个php中问题是每次访问帖子时,都会再次导入评论,所以我有1000条重复评论
有人能帮我吗?