Support » Fixing WordPress » how to empty trash with 2000 posts at once?

  • Hi!

    I want to mass delete my trash with 2000+ Posts in it. Is there a mysql command to do so?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Please backup before running the query, i’ll not take responsibility if something goes wrong as a result..

    DELETE p
    FROM wp_posts p
    LEFT OUTER JOIN wp_postmeta pm ON (p.ID = pm.post_id)
    WHERE post_status = 'trash'

    Join is optional, removes entries from the meta table (if they exist).

    Tested under MySQL 5.1 in Phpmyadmin.

    I’m also interested in emptying the trash. Before I try this query, I just want to confirm that it is designed to ONLY delete items with a post_status of “trash.”

    This might be a dumb question, but my knowledge of MySQL is just enough to make me dangerous.

    And can I assume that the above query can be copied and pasted as is into the correct database query form?

    Yes, I WILL back up before attempting. But I don’t want any surprises that occur as a result of my ignorance.


    Nevermind. I couldn’t wait and tried it anyway. It worked just as I hoped: it deleted all the posts in the Trash.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to empty trash with 2000 posts at once?’ is closed to new replies.