WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. petercasier
    Member
    Posted 1 year 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?

    thanks,

    Peter

    http://wordpress.org/extend/plugins/feedwordpress/

  2. 3x7
    Member
    Posted 1 year 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:

    http://wordpress.org/extend/plugins/wp-mass-delete/

    http://wordpress.org/extend/plugins/bulk-delete/

    Cheers!

  3. petercasier
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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...

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic