• I am looking for a SQL statement that will help clean my database out of all posts that are unpublished (I have thousands of them now due to newsfeeds)

    I think there are some relational tables between posts and other things, so I want to make sure the DB is clean and easier to manage.

Viewing 2 replies - 1 through 2 (of 2 total)
  • in WP 2.8 you can do this in a reasonable amount of time in the WordPress admin area.

    1) go to edit posts list page
    2) Near the top click on Draft
    3) near the top right click on Screen options, and set Posts per Page to 1000 – close screen options.
    4)at the top on the grey line, at the left, click the checkbox next to the word Posts – this highlights every post on the page
    5) in the Bulk Actions pulldown, set it to Delete
    6) Click the Apply button
    That deletes 1000 posts all at once.
    Repeat the process until they are all deleted.

    Depending on one’s server you might get a “Request-URI Too Large” error. I’ve been looking into this, and I think that I’ll go to MySQL and delete the content of the wp_postmeta and wp_posts tables

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SQL to delete posts’ is closed to new replies.