Bulk delete WordPress posts

Taken from WP Stackexchange

Don’t try to Bulk delete WordPress posts with SQL.

There is post information is multiple tables. You will end up with orphan data scattered throughout the database. While it is possible to write the JOINs you’d need to delete everything, the SQL could be complex.

Create a simple Loop and use the Core to delete your posts.

$args = array( 
  'post_type' => 'post',
  'ignore_sticky_posts' => true,

$del = new WP_Query( $args );

while ($del->have_posts()) {
  wp_delete_post( $post->ID, false ); 


Tags: ,

No comments yet.

Leave a Reply