2009/06/18

Remove all posts

Sometimes you may want to remove all posts from your Wordpress. You can do this from Wordpress dashboard, but you have to do delete them page by page, and each page has only 20 posts.

If you really wanted to remove all post at a time, here is Perl script to do so.

use WordPress::XMLRPC;
my $o = WordPress::XMLRPC->new({
username => 'admin',
password => 'yourpass',
proxy => '/path/to/your/xmlrpc.php',
});
#print $o->getPost();
my $post = $o->getRecentPosts(500); #500 meant get 500 posts
for $p (@$post) {
 $id =  $p->{'postid'};
 #print "$id\t";
 $o->deletePost($id);
}
PERL WORDPRESS XMLRPC Module can be found at here

No comments:

Post a Comment