WordPress回收站里有很多陈旧文章或者草稿,此时需要删除手动很花费时间,而且很累,通过数据库SQL命令,我们来轻松完成。
解决办法:
登录数据库管理后台,找到网站对应的数据库,在SQL中输入并执行以下语句:
delete from wp_posts where post_status="trash";
此外,一次性删除文章草稿的SQL语句为:
delete from wp_posts where post_status="draft";
如果想批量删除所有文章或者草稿:
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
提示:操作数据库前,记得备份数据库,安全首要。