wordpress批量删除文章步骤
1、进入网站后台,点击后台菜单【设置-撰写】,选择一个默认的文章分类;
2、点击后台菜单【文章-分类目录】,删除所有的分类目录,保留默认的分类目录;这样被删除的分类目录下的文章都会被转到默认分类下;
3、进入网站空间后台,点击数据库管理,在SQL框中,粘贴以下SQL语句。
delete from wp_posts using wp_posts, wp_term_relationships, wp_term_taxonomy where wp_posts.id=wp_term_relationships.object_id and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id and wp_term_relationships.term_taxonomy_id = 1
注:以上的SQL语句中,taxonomy_id = 1 后面的“1”是默认分类ID号,如果你的默认分类ID不是1,要更换成你自己的默认分类ID号。
4、执行以上的SQL语句,就可以一次性删除网站所有文章了。
以上一次性删除wordpress所有文章的方法,亲测有效,帮助我们自己做网站节省大量的无用功时间。
补充:
一次性全部清空文章和分类
delete from wp_posts where ID >= 1; delete from wp_postmeta where meta_id >= 1; delete from wp_term_relationships where object_id >= 1; delete from wp_term_taxonomy where term_id >= 1; delete from wp_terms where term_id >= 1; delete from wp_termmeta where meta_id >= 1;
清空回收站语句
delete from wp_posts where post_status="trash";
清空草稿语句
delete from wp_posts where post_status="draft";