WordPress.org

Support

Support » How-To and Troubleshooting » how to remove thousads of approved spam comments

how to remove thousads of approved spam comments

  • 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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator cubecolour

    @numeeja

    ɹoʇɐɹǝpoɯ

    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.

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

    Moderator cubecolour

    @numeeja

    ɹoʇɐɹǝpoɯ

    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.

    Moderator cubecolour

    @numeeja

    ɹoʇɐɹǝpoɯ

    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.

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

    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.

    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

    @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

    majorhameed

    @majorhameed

    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.

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘how to remove thousads of approved spam comments’ is closed to new replies.
Skip to toolbar