Delete all posts of a custom post type—efficiently

Question

I’m looking for a safe and fast way to delete all of one custom post type’s posts. Using get_posts() and wp_delete_post() for each returned post does not work; it’s not fast enough due to the sheer amount of database queries involved (timeout error).

Preferably, I’m looking for a single database query to run that deletes all posts that are of a custom post type. Any thoughts?

0
, , Marcus McLean 3 years 2020-06-04T11:11:49-05:00 0 Answers 101 views 0

Leave an answer

Browse
Browse