WordPress.org

Ready to get started?Download WordPress

Forums

Kill the Post-less Comment Spam (12 posts)

  1. TechGnome
    Moderator
    Posted 9 years ago #

    I know that not everyone got the now infamous "TG's Code" (thanks Podz). To help follow up on that, the following directions are aimed to delete any posts that may have gotten through before the code was installed.

    1. Open your myPHPAdmin, select your database, then click the "SQL" link.
    2. If you don't have myPHPAdmin, or your host provided a different interface for your database, open what ever screen necessery to run a SQL Statement.
    3. Enter this SQL:
      DELETE wp_comments FROM wp_comments C LEFT JOIN wp_posts P ON C.comment_post_ID = P.ID WHERE P.ID IS NULL
    4. Click the "Go" button. This will delete any comments that do not have a related post.

    DISCLAIMER: I will only provide MINIMAL support for this. Use at your own risk. This code is provided AS IS, and no warranty is supplied or implied. As always, it is good practice to make a backup before following this. If you don't and something goes wrong, sorry, but you are SOL. Tax, title, and license extra. Batteries not included. Some assembly required. Not suitable for all ages.
    Tg

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    And I shan't name this.
    Really.
    Promise.
    :)

  3. Just in case people stumble across this topic in the future...
    TG's Code: http://www.tamba2.org.uk/wordpress/spam/#seven
    Illustrated instructions for the first post in this thread: http://www.tamba2.org.uk/wordpress/spam/#imm

  4. Mark (podz)
    Support Maven
    Posted 9 years ago #

  5. Podz, you are amazing.

  6. TechGnome
    Moderator
    Posted 9 years ago #

    *snicker @ podz* I see you posted it word for word.... right down to the disclaimer..... *snicker* *snicker* *snicker*
    Tg

  7. Mark (podz)
    Support Maven
    Posted 9 years ago #

    I could name it .......
    ;)

  8. TechGnome
    Moderator
    Posted 9 years ago #

    Might as well.... I've now got "TG's Code" and "TG's Soapbox".... what's one more?
    Tg

  9. MathiasBynens
    Member
    Posted 9 years ago #

    I'm getting an error:

    Error
    SQL-query:
    DELETE wp_comments FROM wp_comments C LEFT JOIN wp_posts P ON C.comment_post_ID = P.ID WHERE P.ID IS NULL
    MySQL said:
    #1064 - You have an error in your SQL syntax near 'wp_comments FROM wp_comments C LEFT JOIN wp_posts P ON C.comment_post_ID = P.ID' at line 1

    Any ideas?

  10. MathiasBynens
    Member
    Posted 9 years ago #

    Hmm, I knew how to manually delete data from a database... I just thought it would be cool if I got the above code to work.

  11. indiaberry
    Member
    Posted 7 years ago #

    Thanks for this information. About time I found this. I am going to use the phpmyadmin to manually delete comments that are in moderation. I have deleted a lot until I reach down to 16143 comments. That is still way too much to delete through wordpress so I will do it from the phpmyadmin. I have already back up my database. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.