Mass Delete of Posts

It can be a real pain to delete several (not to mention thousands) of posts using the built-in Manage/Posts section of the wp-admin panel. While there are a few bulk post management plugins out there, I wasn’t able to find one that worked as I needed it to.

Read on to find out how I made a simple tweak to one of these plugins and was able to painlessly delete massive amounts of unwanted posts.

The Problem:

So I had a WordPress driven site which had been configured to syndicate articles to a particular category. These titles would then appear as supplemental news items at the bottom of post pages. When I decided that I no longer needed these syndicated items kept as posts in my WordPress database, I was left with the dilemma “How am I going to delete these 3000+ posts from the database without getting into manual MySQL queries?

Unsuccessful Attempt

First I downloaded the Mass Post Manager plugin. I selected the target category and chose the option to delete all posts from the category, yet when I returned to the same plugin admin screen, the same 3000+ posts were still there! Now I’m sure this plugin works great in some environments, and it may work for you and yours. But as for my WP 2.5.1 site, it didn’t work.

Getting There…

Then I downloaded and installed the Batch Categories plugin and everything worked as it should, but there was one little problem: it only handles 15 posts at a time. The only advantage over using the built-in Manage/Posts admin interface is that with this plugin I could check the top ‘select all’ check box and not have to worry about filtering out posts from the one category, as it filters them for you in the first step.

Success!

Hopefully, I opened the plugin file and found the area that set the post listing limit to ’15′ and changed it to ’500′. And whaddya know, it worked just fine!

Here’s the step-by-step:

  1. Download Batch Categories
  2. Unzip it to your computer and open the admin.php file
  3. Search for ’15′ (line 22) and replace with a larger number (I chose ’500′ and had no problems)
  4. Upload the entire batch categories folder to your ../wp-content/plugins/ directory and activate the plugin from your wp-admin panel.
  5. In your admin panel, go to Manage/Batch Categories. In the dropdown box select the category you wish to delete posts from, and click Filter

  6. Click the top check box to select all the listed posts and scroll to the bottom
  7. Be sure to select the target category again at the bottom or nothing will happen! Then click Remove From

  8. Rinse and repeat until all your unwanted posts are deleted

Moving Posts to Another Category

To move posts to another category you need to select the post, then at the bottom choose the new category that it will be assigned to and click “ADD TO”. Then on the next page select the post again, scroll to the bottom and choose the category you want the post removed from and click ‘REMOVE FROM’.

You can leave a response, or pingback from your own site by linking to this article.

4 Responses to “Mass Delete of Posts”

  1. Mary says:

    Thanks a ton! The latest version of Batch Categories doesn’t work well with WP 2.8, but I was able to cobble through…

  2. Mary says:

    Actually I take that last comment back. If you follow the directions here, you’re simply moving all the posts into the ‘uncategorized’ category, not deleting them. Now, you could put all into a ‘delete me’ category and then go in w/another plugin and delete them all, but this is a lot of work. Here’s what I did:

    Changed this line in wp-admin\includes\post.php (823 in WP 2.8):

    $posts_per_page = 15;

    to

    $posts_per_page = 400;

    (this seems to be the limit, tried 500 and it crashed)

    Now, I can sort and delete using the ‘Edit Posts’ interface, and just change it back later (I need to delete only old posts in a certain category, and have 19K).

    As always, BE CAREFUL when mass deleting posts, and make sure you have a backup!

    Mary

    • Interstice Solutions says:

      Mary, I’ve found that you can delete them using this plugin, but it’s a little tricky to make sure you’re selecting the correct options –you have to select the posts, then at the bottom select to remove them and have the cat their in selected also. Thanks for sharing your experience with setting posts_per_page. Yep, always a good idea to be careful. In fact making a database backup before deleting stuff is the best way to go.

  3. ahmed says:

    thank you dear Mary i just edit the wp-admin\includes\post.php page to 50 that’s really helpful
    many thanks

Leave a Reply




Pingbacks

Erin Bruce
Cassie Bruce