Results 1 to 7 of 7

Thread: MySQL Query Needed to Delete Older Comments in Wordpress

  1. #1
    Registered Member
    Join Date
    Jan 2013
    Posts
    20
    cPanel/WHM Access Level

    Website Owner

    Default MySQL Query Needed to Delete Older Comments in Wordpress

    Hello everyone

    I run a self-hosted WordPress blog which has approx. 2000 topics. Many of them contain more than 200 comments.

    I want to have a MySQL query which first searches for posts which have more than a fixed number of comments such as 50 comments and then delete the extra old comments.

    For example, the query searches for posts having more than 50 comments and then it deletes all old comments from those posts to make their comment count under 50.

    I'll really appreciate if someone can provide such query statement.

    Thanks in advance.

  2. #2
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    11,426
    cPanel/WHM Access Level

    Root Administrator

    Default Re: MySQL Query Needed to Delete Older Comments in Wordpress

    You might do better to ask about this sort of thing over on wordpress.org

  3. #3
    Registered Member
    Join Date
    Jan 2013
    Posts
    20
    cPanel/WHM Access Level

    Website Owner

    Default Re: MySQL Query Needed to Delete Older Comments in Wordpress

    ^^ Thanks for your reply. I asked there already but didnt get a single reply in 4 days.

  4. #4
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    11,426
    cPanel/WHM Access Level

    Root Administrator

    Default Re: MySQL Query Needed to Delete Older Comments in Wordpress

    Probably has been answered so many times no one cared to help you out.

    /http://wordpress.stackexchange.com/questions/15870/how-to-delete-old-comments-by-date
    /http://gerardmcgarry.com/blog/wordpress-deleting-comments-old-blog-entries


    I googled: delete old comments on wordpress


    GL!

  5. #5
    Registered Member
    Join Date
    Jan 2013
    Posts
    20
    cPanel/WHM Access Level

    Website Owner

    Default Re: MySQL Query Needed to Delete Older Comments in Wordpress

    Sorry to say but I have already checked those topics. They came on first page while searching on Google. My question is different. I dont want to delete all older comments. I want to delete comments from only those topics which contains more than 50 comments. I want to keep latest 50 comments from each topic and delete all previous comments from those topics.

  6. #6
    cPanel Staff cPanelJared's Avatar
    Join Date
    Feb 2010
    Location
    Houston, TX
    Posts
    1,800
    cPanel/WHM Access Level

    Root Administrator

    Default Re: MySQL Query Needed to Delete Older Comments in Wordpress

    Instead of closing the thread, would you mind sharing the solution you found for the benefit of the community?
    For hands-on assistance, please reference our new support information page: Where should I go for support?
    cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists(Alt) - Documentation - Find cPanel hosting


    -- Jared Ryan, Technical Analyst, cPanel Technical Support

  7. #7
    Registered Member
    Join Date
    Jan 2013
    Posts
    20
    cPanel/WHM Access Level

    Website Owner

    Default Re: MySQL Query Needed to Delete Older Comments in Wordpress

    ^^ No one helped so I decided to manually delete comments from older topics using Wordpress Admin CP. It'll take time but thats the last option to do.

Similar Threads

  1. Wordpress query
    By scampsall in forum General Discussion
    Replies: 2
    Last Post: 11-16-2010, 07:48 AM
  2. How to delete all mails on server older than X years..
    By ramystyle in forum E-mail Discussions
    Replies: 1
    Last Post: 04-07-2008, 02:29 AM
  3. Delete mail queue older than 3 days
    By jameshsi in forum E-mail Discussions
    Replies: 10
    Last Post: 10-07-2005, 06:34 AM
  4. Delete messages in queue older than xx days ?
    By pguy in forum General Discussion
    Replies: 7
    Last Post: 02-02-2004, 01:40 PM
  5. How to delete email that is older than x amount of days?
    By Roberto in forum E-mail Discussions
    Replies: 3
    Last Post: 01-09-2004, 05:55 PM

Tags for this Thread

bargain