tags:

views:

73

answers:

1

I am running the following piece of code (assume all variables have values) is a custom importer that I am trying for Joomla2Wordpress.

$ret_id = wp_insert_post(array(
  'ID'   => $pinfo,
  'post_date'  => $Posted,
  'post_date_gmt'  => $post_date_gmt,
  'post_author'  => $authorid,
  'post_modified'  => $LastMod,
  'post_modified_gmt' => $post_modified_gmt,
  'post_title'  => $Title,
  'post_content'  => $Body,
  'post_excerpt'  => $Excerpt,
  'post_status'  => $post_status,
  'post_name'  => $sefurl,
  'comment_count'  => $comments_count)
 );

However while the code inserts post correctly, the comments count is not updated (remains zero). The codex page doesn't mention the parameter at all.

Can anybody help?

A: 

wp_insert_post() does not update the comment count, you have to call wp_update_comment_count_now() to update accomplish that.

windyjonas