Home Uncategorized Bulk delete wordpress posts

Bulk delete wordpress posts


I had a project a while back which involved adding thousands of text files to a WordPress account as new posts.  In the process of testing the Import step using CSV Importer I would have the full import fail because some of the files were corrupt or of a different format or invalid characters which I didn’t write into the escape function I used on the source files…if you’ve ever done this kind of scripting then you know what I’m talking about 🙂

Anyway, when you have +1,000 Wordpress posts, the Bulk Delete script has some trouble because of script timeout and/or not enough memory being allocated.   

Here is one way to get around it, but you will need access to your PHP.INI file on the server:

      Adjust some values in the PHP.ini file:
      max_execution_time = 600 ; Maximum execution time of each script, in seconds
      max_input_time = 30; Maximum amount of time each script may spend parsing request data
      memory_limit = 256M ; Maximum amount of memory a script may consume (8MB)

*These settings reportedly worked for someone with 5,800 posts to delete in one category
*Make sure you backup your site before doing anything, and especially backup the PHP.INI file so that you can go back to the defaults afterward.
*If you don’t know the path of the PHP.INI file then you can unzip and upload this file: myPHP.php to the root of your hosting account and then pull it up with your Internet browser and it will tell you where the file is.
*If all else fails, you can set the WordPress Screen Options->Show On Screen value to 117 (or higher depending on your config) and just start trashing them.  The Screen Options are found in a dropdown top-right corner of the WordPress Admin screen.  FYI: I couldn’t just delete them one batch after the other; if I did then I received a 404 error: Webpage Cannot Be Found.  Instead, I had to delete 117, then click on Posts again, then delete another 117..and so on.

If you can’t modify the PHP.INI file, then there is more info on increasing memory for WordPress scripts HERE


Please enter your comment!
Please enter your name here