[wp-trac] [WordPress Trac] #10816: wp_insert_post fails to add comment_count

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 19 13:05:23 UTC 2009


#10816: wp_insert_post fails to add comment_count
--------------------------+-------------------------------------------------
 Reporter:  debashish     |       Owner:                                      
     Type:  defect (bug)  |      Status:  new                                 
 Priority:  high          |   Milestone:  Unassigned                          
Component:  General       |     Version:  2.8.4                               
 Severity:  critical      |    Keywords:  comment,comment count,wp_insert_post
--------------------------+-------------------------------------------------
 I am running the following piece of code (assume all variables have values
 and that $comments_count is a number) 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 the post correctly, the comments count is
 not updated (remains zero). The codex page doesn't mention the parameter
 at all.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10816>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list