• Resolved pinokio

    (@lapanwebsite)


    While importing everything to new install, I got 500 errors (slow hosting, timeouts…), so I had to repeat process many times until everything finished.

    I have many duplicated comments, how can I delete them?

    Is there plugin or some sql query?

Viewing 3 replies - 1 through 3 (of 3 total)
  • found this:
    http://stackoverflow.com/questions/6802996/mysql-query-to-delete-duplicate-wordpress-comments

    thats an interesting question so do let know if you solve it.. 🙂

    Thread Starter pinokio

    (@lapanwebsite)

    Taking a look at some of the images of WordPress’ schema then you should be able to identify the records you want to delete with a query such as

    SELECT wp_comments.*
    FROM wp_comments
    LEFT JOIN (
        SELECT MIN(comment_id) comment_id
        FROM wp_comments
        GROUP BY comment_post_id, comment_author, comment_content
    ) to_keep ON wp_comments.comment_id = to_keep.comment_id
    WHERE to_keep.comment_id IS NULL

    You should run the query above and make sure you it is returning the correct records (the ones that will be deleted). Once you are satisfied the query is working then simply change it from a SELECT to a DELETE

    DELETE wp_comments
    FROM wp_comments
    LEFT JOIN (
        SELECT MIN(comment_id) comment_id
        FROM wp_comments
        GROUP BY comment_post_id, comment_author, comment_content
    ) to_keep ON wp_comments.comment_id = to_keep.comment_id
    WHERE to_keep.comment_id IS NULL

    By TI from stackoverflow.

    Thanks for sharing.. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Remove duplicated comments?’ is closed to new replies.