Skip to content

Instantly share code, notes, and snippets.

@norcross
Created March 25, 2013 20:22
Show Gist options
  • Save norcross/5240363 to your computer and use it in GitHub Desktop.
Save norcross/5240363 to your computer and use it in GitHub Desktop.
delete an author's posts
<?php
function mass_delete_author() {
$args = array(
'fields' => 'ids',
'author' => 31,
'posts_per_page' => 100,
'no_found_rows' => true,
'cache_results' => false
);
$posts = get_posts($args);
foreach ($posts as $post_id ):
wp_delete_post( $post_id, true );
endforeach;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment