Is there a way to mass delete syndicated posts with an SQL script? (4 posts)

  1. petercasier
    Posted 3 years ago #

    I am running up a large amount of aggregated posts, too big for MySQL to handle. Mass deleting posts thru existing plugins takes too long, and hits system timeouts.

    I found this post listing an SQL script to delete posts thru PHPMyAdmin:

    delete a,b,c,d
    FROM wp_posts a
    LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
    LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
    LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
    LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
    WHERE e.term_id =<category id>

    (where <category id> is the category id number)

    This seems to work well for "normal" posts, but I think this would not clean up post metadata correctly.

    Does someone know the correct script to mass delete aggregated posts, with its metadata?




  2. 3x7
    Posted 3 years ago #

    When you click to remove the specific rss sindication it asks you what to do and there is option to "remove posts of this feed also"?

    Or you can try this plugins:




  3. petercasier
    Posted 3 years ago #

    @3x7: Thanks for your suggestion, but the "remove posts from this feed also" option, and the existing mass-delete plugins are too slow to execute (Over the past years, I racked up over 100,000 posts). Both hit the timeouts of my server (which are already set at very high values), and take ages to delete just 1000 posts.

    Experimenting on a test database with the above script, shows a delete of 350,000 posts is done in 120 seconds. But I am not sure if it does not leave any garbage in the database.... That is really the question...

  4. 3x7
    Posted 3 years ago #

    well it leaves some garbage for sure, specially if there were plugins that did some processing with posts and saved some post meta to their tables...

    Try WP-Cleanup plugin after deleting..

    Or I would suggest you to hire a developer to create this simple script with your code to remove all posts and all associated data to the posts.. this should not be expensive work...


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • FeedWordPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic