WordPress.org

Support

Support » Plugins and Hacks » Fix to get correct comment count

Fix to get correct comment count

  • Hi,

    I found that the comments importer works in WordPress 3.5, however the comment count for every post did not get updated.

    To fix this, simply change this in FacebookCommentImporter.php on line 220 onwards from:

    if ($db->insert($db->prefix.'comments', $data)) {
                    $this->commentMap[$comment['id']]['id'] = $db->insert_id;
                } else {
                    return;
                }

    to:

    if ($wpcid = wp_insert_comment($data)) {
                    $this->commentMap[$comment['id']]['id'] = $wpcid;
                } else {
                    return;
                }

    That uses the WordPress function to insert the comment instead of writing directly to the database. This also updates the comment_count in the wp_posts table.

    http://wordpress.org/extend/plugins/facebook-import-comments/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fix to get correct comment count’ is closed to new replies.