1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How To Delete Only Comments With Link In them In Wordpress?

Discussion in 'Blogging' started by Chicilikit, Nov 14, 2013.

  1. Chicilikit

    Chicilikit Senior Member

    Joined:
    Dec 21, 2010
    Messages:
    886
    Likes Received:
    156
    Hello, I have now about 4K comments on blog and I want to filter out only those comments with links (because they are of course 99% spam). I cannot find any plugin or method that could do this, can anyone help? Thanks for any ideas :)
     
  2. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,067
    Likes Received:
    2,882
    Gender:
    Male
    Can be done with SQL. Backup your db,go to sql browser and run the following sql.

    Code:
    DELETE FROM `wp_comments` WHERE comment_content LIKE "%http://%"
    Warning: This is untested. You may like to test it before running.
     
    • Thanks Thanks x 1
  3. Chicilikit

    Chicilikit Senior Member

    Joined:
    Dec 21, 2010
    Messages:
    886
    Likes Received:
    156
    Thanks it worked great, but much more efficient was to use it on comment_author_url. lol I found with this method that I had ONE real comment and 4061 spams :)
     
  4. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,067
    Likes Received:
    2,882
    Gender:
    Male
    Glad it helped :)
     
  5. blackbeans

    blackbeans Jr. VIP Jr. VIP

    Joined:
    Nov 29, 2008
    Messages:
    922
    Likes Received:
    188
    Occupation:
    Entrepreneur
    Home Page:
    You might want to install a NOHASH comment filter plugin. Most spam comments use a NOHASH method for posting. I use a plugin that uses this method of filtering spam and I've been spam-free. For some reason, using AKISMET alone isn't enough. You'd think Akismet would do a good job because of its central db-based reported spam filtering, but it doesn't.