How to delete older posts by date/ day range in WordPress?

Many people are finding hard to delete the older posts of WordPress website as they are consuming a lots of space in hosting and even in search indexing that make website super slow. There are different types of plugins to delete that un-necessary older posts but that also takes lots of time on deleting procedures.

For quick remedy, here I have provided you with the mysql code syntax to delete the older posts in super fast method.

First you need to go to your phpMyAdmin of your website database table.

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

(here 730 is the number of days from your current date that will delete all the older posts below from that date.)
Now your older posts will be deleted within a few seconds..!!

Note: Please try this into your localhost first, don’t try this in your live website.

Posted in BlogsTagged ,

One thought on “How to delete older posts by date/ day range in WordPress?

Leave a Reply