Namecheap
+ Post New Thread
Results 1 to 2 of 2

Thread: How to delete all comments that are not approved (are spam, trashed or unapproved)

  1. #1
    Fli
    Fli is online now
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,464

    How to delete all comments that are not approved (are spam, trashed or unapproved)

    make money with your web site


    What are good mysql commands to manage/delete Wordpress comments?

    so far i found this one:
    DELETE FROM wp_comments WHERE comment_approved = 0;DELETE FROM wp_commentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM wp_comments );optimize table wp_comments;optimize table wp_commentmeta;
    This deleted all Wordpress comments in folder SPAM and in folder Awaiting approval, it also deleted comments meta data of the comments that was removed and optimized comments tables to free disk space. Great command.

    Another ways to delete comments:
    google: delete wordpress comments mysql

    ----

    When i cleaned up czech language site i used this command. It is very strict and recommended only for czech wordpresss site. It removes all comments that contain hyperlink for example or all where comment author e-mail is yahoo, live, removes most of the english comments, etc.:

    DELETE FROM `wp_comments` WHERE `comment_approved` = "0" AND `comment_content` LIKE "%href%" OR `comment_content` LIKE "%http%" OR `comment_content` LIKE "%have %" OR `comment_content` LIKE "%the %" OR `comment_content` LIKE "%best %" OR `comment_content` LIKE "%for %" OR `comment_content` LIKE "%good %" OR `comment_content` LIKE "% is %" OR `comment_author_url` LIKE "%.com%" OR `comment_author_url` LIKE "%.ru%" OR `comment_author_url` LIKE "%.in%" OR `comment_author_url` LIKE "%.org%" OR `comment_author_IP` LIKE "%5.188.211%" AND `comment_author_email` NOT LIKE "%.cz%" OR `comment_author_email` LIKE "%yahoo.com%" OR `comment_author_email` LIKE "%mail.ru%" OR `comment_author_email` LIKE "%live.com%" OR `comment_author_email` LIKE "%sify.com%" OR `comment_author` LIKE "%http%" OR `comment_approved` = "post-trashed";DELETE FROM wp_commentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM wp_comments );optimize table wp_comments;optimize table wp_commentmeta;

  2. #2
    Senior Member webc's Avatar
    Join Date
    Feb 2014
    Posts
    358


    Is this useful / helpfull? Yes | No
    Drop or empty the comments table using phpmyadmin

+ Post New Thread

Similar Threads

  1. How to delete Spam And bad backlinks..?
    By ruhikhan in forum SEO - Search Engine Optimisation
    Replies: 1
    Last Post: 06-03-2019, 11:31 AM
  2. Replies: 0
    Last Post: 02-19-2015, 02:25 PM
  3. Replies: 0
    Last Post: 11-25-2014, 12:02 PM
  4. Replies: 0
    Last Post: 11-22-2014, 04:02 PM
  5. Approved blog comments package
    By webc in forum Marketplace
    Replies: 0
    Last Post: 02-23-2014, 10:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam