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()) {
$del->the_post();
wp_delete_post( $post->ID, false );
}
Revisions
- March 15, 2015 @ 12:37:15 [Current Revision] by PeterLugg
- March 15, 2015 @ 12:37:15 by PeterLugg
No comments yet.