Support » Plugin: Copy or Move Comments » Wrong comment count

Viewing 3 replies - 1 through 3 (of 3 total)
  • Seems that the comment count gets mixed up sometimes by this and other plugins.

    Found a nice Fix that worked fine for here:

    http://bit.ly/1ra0V2O

    Nevertheless you should fix this in your plugin.

    Here the code of the post slightly modified by me since it was tied to a specific database name:

    /* Query for checking before and after fixing posts/pages with wrong count */
    SELECT wpp.id, wpp.post_title, wpp.comment_count, wpc.cnt
    FROM wp_posts wpp
    LEFT JOIN
    (SELECT comment_post_id AS c_post_id, count(*) AS cnt FROM wp_comments
    WHERE comment_approved = 1 GROUP BY comment_post_id) wpc
    ON wpp.id=wpc.c_post_id
    WHERE wpp.post_type IN (‘post’, ‘page’)
    AND (wpp.comment_count!=wpc.cnt OR (wpp.comment_count != 0 AND wpc.cnt IS NULL));

    /* Query for actually fixing the count for all affected posts */
    UPDATE wp_posts wpp
    LEFT JOIN
    (SELECT comment_post_id AS c_post_id, count(*) AS cnt FROM wp_comments
    WHERE comment_approved = 1 GROUP BY comment_post_id) wpc
    ON wpp.id=wpc.c_post_id
    SET wpp.comment_count=wpc.cnt
    WHERE wpp.post_type IN (‘post’, ‘page’)
    AND (wpp.comment_count!=wpc.cnt OR (wpp.comment_count != 0 AND wpc.cnt IS NULL));

    Plugin Author AppJetty

    (@biztechc)

    Thanks c2cero for pointing mistake,we will update this in next release.

    Plugin Author AppJetty

    (@biztechc)

    Hi c2cero,

    We have solved wrong counter issue in latest release.
    Thanks

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