How to remove any post that is older than X days in WordPress

To remove any post that is older than X days in WordPress you can use the query below.

Sample mySQL

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

Please Share us:
Please rate this snippet

4 thoughts on “How to remove any post that is older than X days in WordPress

Leave a Reply