I have about 90,000 posts in my WordPress and want to delete most of them using a plugin. I fetch all IDs from the posts that need to be deleted and then do the following:
// $delete_posts contains all IDs
foreach ($delete_posts as $dp) {
wp_delete_post($dp, true);
}
I'm sitting here wondering why my plugin doesn't work as expected - I checked my database with PhpMyAdmin and realized that the posts are deleted very very slow. Maybe 30 posts per second? That's definitely too slow. Or am I misusing this function to delete posts?