WP SQL – Batch delete old posts


WP SQL – Batch delete old posts

18 Juil 2013, Posted by antoine in

Don’t need those posts published years ago? Delete them using this query. This example is set to delete any post which is older than 600 days. If you want to make an even better version of this query, what about mixing it with the one below to remove old posts as well as their metadata?

DELETE FROM `wp_posts`
WHERE `post_type` = 'post'
AND DATEDIFF(NOW(), `post_date`) > 600

→ Source: http://stackoverflow.com/questions/5317599/wordpress-automatically-delete-posts…