WordPress.org

Ready to get started?Download WordPress

Forums

how to remove thousads of approved spam comments (11 posts)

  1. phoenixo
    Member
    Posted 2 years ago #

    I have a site that has over 200,000 spam comments that have been automatically approved. I've since changed the setting to block comments but is there a way for me to delete all these approved comments in bulk. I used the "Bulk comment remove" plugin but that only works on pending comments. I need to mass delete all my approved comments.

    Please help.

  2. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 2 years ago #

    You could do this in PhpMyAdmin with a query:

    delete from wp_comments WHERE comment_approved ="1";

    This will delete ALL approved comments - change wp_ to your actual database table prefix and remember to backup your database first.

  3. phoenixo
    Member
    Posted 2 years ago #

    I'm working on the site totally live is there a particular template I can go into and change that code?

  4. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 2 years ago #

    The line I listed is a SQL Query, not PHP code to go in a template.

    Your hosting control panel should have PHPmyAdmin or perhaps a similar tool to enable you to run a query.

    Making changes in the database can really mess up your database, so make sure you have a database database backup before running any SQL query.

  5. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 2 years ago #

    Approaching this from another angle:

    Looking at the code of the 'bulk comments remove' plugin you mentioned, there are a couple of places where the comments being acted on are selected using

    WHERE comment_approved = '0'

    It may be possible to use a modified version of the plugin to perform its function on approved comments instead of unapproved by changing the '0' to '1' in those lines - there may be other changes necessary though, so don't try it yet as I have not tested it.

    I've added the 'bulk-comment-remove' tag to this topic, so hopefully the plugin author will see it and will be able to advise. If this will work it will probably be your easiest option if you have not used PHPmyAdmin before.

  6. phoenixo
    Member
    Posted 2 years ago #

    Thank you so much Sir! You saved my life. I tested it and it totally worked. Thank you, thank you, thank you :-)

  7. cjbmeb14
    Member
    Posted 1 year ago #

    Now that WordPress has been updated there is a much simpler way to delete approved comments in bulk.
    1. Go to phpmyadmin
    2. Choose your database from the left: wrdp1 for example.
    3. You will see wp_comments in the main page.
    4. Follow that along and select empty.
    All comments will now be gone.

  8. Sweet JP
    Member
    Posted 1 year ago #

    I had a serious approved comment problem across multiple blogs, and since I didn't want to waste time backing up and tweeking out every single database one at a time, I used mikes code to whip together a quick plugin.
    Worked like a charm on dozens of blogs from WP 3.0 up to WP 3.4.
    Here is the Download link:
    http://www.jessepupparo.com/2012/08/31/simple-plugins-to-remove-all-wordpress-comments-pending-and-approved/
    All respect should go to Mike Strand from http://allcreatives.net/ (it was his code I used).
    Peace and luv.
    -Sweet J

  9. hannx
    Member
    Posted 1 year ago #

    @cjbmeb14

    I followed the suggestions below, seemed straightforward, but now website is inaccessible, saying "Error establishing a database connection". Appreciate responsibility my own, but would be happy for suggestions to recover website.

    I did restore the database, but website still inaccessible

    Followed:

    "Now that WordPress has been updated there is a much simpler way to delete approved comments in bulk.
    1. Go to phpmyadmin
    2. Choose your database from the left: wrdp1 for example.
    3. You will see wp_comments in the main page.
    4. Follow that along and select empty.
    All comments will now be gone. "
    https://wordpress.org/support/topic/how-to-remove-thousads-of-approved-spam-comments?replies=9#post-2763222

  10. majorhameed
    Member
    Posted 1 year ago #

    Now that WordPress has been updated there is a much simpler way to delete approved comments in bulk.
    1. Go to phpmyadmin
    2. Choose your database from the left: wrdp1 for example.
    3. You will see wp_comments in the main page.
    4. Follow that along and select empty.
    All comments will now be gone.

    Wow its a simple way and very easy to do this.
    cjbmeb14 is a superman for this types of problem. thank you much.

  11. SandyMe
    Member
    Posted 1 year ago #

    Excellent advice cjbmeb14 and majorhameed! Thank you. Worked perfectly!

Topic Closed

This topic has been closed to new replies.

About this Topic