Use MySQL to empty WordPress trash

by Dec 25, 2019Wordpress0 comments

Use MySQL to empty WordPress trash

If your WordPress trash has thousands of deleted items, it might be tricky to empty it from within WordPress.

This is because your webhost might block requests that take a long time and you will either corrupt the database or you will receive an unresponsive error.

In rare cases, your webhost might also block your account because the emptying of trash in WordPress takes a lot of time and resources.

Your best bet is to use a direct SQL query to remove posts from your trash. Be careful though because if you put a wrong query you might remove posts that are not in the trash.

In this video, I show you how to empty your WordPress trash directly in MySQL without going through wp-admin. 

The Query to paste in the SQL window: DELETE p FROM wp_posts p LEFT OUTER JOIN wp_postmeta pm ON (p.ID = pm.post_id) WHERE post_status = ‘trash’

Disclaimer: Use the instructions in this video at your own risk and always backup your site before performing operations on its database. We are not responsible for any data loss or damage that might occur to your website


Submit a Comment

Your email address will not be published. Required fields are marked *

Follow Us

Pin It on Pinterest

Share This