Opened 15 years ago
Closed 15 years ago
#10816 closed defect (bug) (invalid)
wp_insert_post fails to add comment_count
Reported by: | debashish | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.8.4 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (2)
#1
@
15 years ago
- Keywords comment comment count wp_insert_post removed
- Milestone Unassigned deleted
- Priority changed from high to normal
- Resolution set to invalid
- Severity changed from critical to normal
- Status changed from new to closed
The wp_insert_post function purposefully does not set comment_count.
comment_count is updated for the post using the wp_update_comment_count_now() function.
Closing as invalid.
Note: See
TracTickets for help on using
tickets.
The custom importer that I am creating for Joomla2Wordpress Import