Delete Posts

Cleans your WP installation for unwanted posts


Thank you for purchasing my plugin. If you have any questions that are beyond the scope of this help file, please feel free to email me directly or via Envato author contact form. Thanks so much!

Delete Posts is a plugin used to delete a large number of Wordpress posts/custom-posts/entities without blowing your server or making your keyboard keys go apart. When we say “a lot” this means 1k, 10k, 100k of posts, or even more. 
This plugin was inspired by a client, having as a spam 12 000+ posts made automatically, with the title “HERE IS TITLE”. The task was to clean the database. As Wordpress creates a lot of “satellite pieces of information” around any created post, like relations, meta information, and so on, we couldn't just make a simple SQL call, but use Wordpress functionality, like wp_delete_post(). That’s how this plugin works - it will first search for your queried posts, retrieve this info, and if you agree, delete posts, in small groups, using AJAX, till the database is clean. 
 

 

You will build a query which will search the database for certain posts. Once found, those can be deleted in groups, infinitely, or till your queried posts will end. Follow these steps: 

1) Go in Settings > Delete Posts page. 

2) In Search criterias create your query. For example, in my upper case, I selected category Post and Page Parameters then subcategory Post Title. Parametres can be found here: https://codex.wordpress.org/Class_Reference/WP_Query

3) An input should be visible now, where I will add my post title. Then press “Test Query”. The dynamic query I created will make a call to the database to search for given query properties, returning a list of posts if succeeded.

 

 
 
4. You can open each found entry to verify it’s content, modify the query or delete what was found. 
 
Attention!!!
Deleted posts cannot be restored in any way, so take your time to verify that the query you made is correct!
 
5. You can also modify the number of posts deleted for each server call from this option:
 

 

The higher the number is, the more your server will have to delete at once, so for small/weak servers, this number should be set lower, for powerful servers - higher. Feel free to adjust this number according to the deleting log and time responses, while in deleting process. 
 
Once started, deletion can be paused, or canceled. As it can take a lot of time, make sure you do not close the browser tab, and your computer does not go to sleep while in deletion process. 
 
Have fun!
 

 
 
 
There is an available filter dp_posts_deletable_query to modify the query in a more expanded manner. Just add this to the functions.php file or another loaded file:
 
function dp_custom_query( $args ) {
   $args['NEW_ARG'] = 'NEW_PROP';
   return $args;
}
add_filter('dp_posts_deletable_query', 'dp_custom_query', 20);
 
This would be the most beauty of the plugin, as you would do basically any type of query with it. Add new meta query arrays, time filters, and so on.