WP SQL – Batch delete old posts18 Juil 2013, Posted by 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