Today I duplicated a site I have running in a certain niche. I needed to delete all the old posts from certain years, and couldn’t find a plugin to do this easily. So. I went into trusty old PHPMyAdmin and did it manually. Here’s what you need to do.

  1. Login to phpmyadmin

  2. Find your wordpress database.

  3. Go to the wp_posts table in the database.

  4. Hit the sql tab in phpmyadmin, and use a variety of the following commands.

To Delete Posts By Date:

DELETE FROM `wp_posts` WHERE `post_date` like '%2008%';

To Delete Posts With Certain Content In The Body:

DELETE FROM `wp_posts` WHERE `post_content` like '%test_content%';

To Delete Posts With Certain Content In The Title:

DELETE FROM `wp_posts` WHERE `post_title` like '%test_content%';

Note that you will have to change the contents between the % and % in those sql statements to your own.

That’s it. Watch it delete your posts in just seconds, instead of hours and hours of work through the wordpress backend.

Hope this helps you out too.