WordPress performance problems trash posts and unattached media

Daniel D. asked 7 years ago

I have a large woocommerce store with over 500k products. The performance issue is that the trash posts and unattached images are not being deleted and taking up space. I set define( 'EMPTY_TRASH_DAYS', 1 ); and also tried define( 'EMPTY_TRASH_DAYS', 0 ); . I have tried various optimize database and delete trash plugins but they all time out due to the fact that there are over 280k trashed posts ( woocommerce products ) and 280k unattached media or images for these posts.

Is there a way to clear these? A plugin to use.

I found - but don't know to implement:

DELETE p

FROM wp_posts p

LEFT OUTER JOIN wp_postmeta pm ON (p.ID = pm.post_id)

WHERE post_status = 'trash'

1 Answers
John M. answered 7 years ago

Hi Daniel,

If you install SQL Executioner it will let you run the SQL code.

This will let you clear out your site.

We reccomend backing up first – Updraft Plus are who we use for this.

Thank you for your custom, we appreciate it.

Kind regards

John

Super Speedy Plugins
Logo