• I have about 50,000 pending posts. I would like to delete them through SQL but I don’t know what to select to delete. Doing them 20 at a time is taking a long time. I also have about 8,000 tags and have the same problem there. If someone could show me what to select with an SQL statement to delete them all at once I would be grateful.

Viewing 3 replies - 1 through 3 (of 3 total)
  • It isn’t SQL, and not a complete answer, but you can delete large batches at a time by clicking ‘Screen Options’ at the top right of the listing of posts and setting ‘Show on screen’ to a large number and using the Bulk delete.

    If your number is too large, you may get timeouts and need to decrease it. I have deleted 900 at a time using this.

    Thread Starter patch7777

    (@patch7777)

    Well that helps. I can move the amount posted to 999. However, I can’t get my server to work on more than 250. Actually, it might go a little higher. It didn’t work on 500 and 250 was my next stop. I deleted a few thousand more. It is still over 40,000 more posts though. This will also help with the tags. In fact it may take care of them as they are now less than 8,000. I would still like to know what the pending posts are listed under in the database along with the tag listing. That would be faster plus now my curiousity is aroused.

    It is not quite as simple as deleting the posts. Posts have info stored in several tables: wp_posts, wp_postmeta, wp_term_relationships, and maybe others.

    If you only delete the posts, records in the other tables will be ‘orphans’.

    I do not have a complete script for totally cleaning up by deleting posts, but perhaps you can find one with Google.

    There is a similar situation with tags. Tags have info in wp_terms, wp_term_taxonomy, and wp_term_relationships.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘bulk delete of pending posts and tags’ is closed to new replies.