【超强SQL】WordPress批量修改指定分类下所有文章状态
前阵子主题君的某一个手游下载站的某一个分类,被百度K了,导致整个分类的文章收录都没了,这时候如果想要回复权重,就需要把这个分类的文章都删除了。
下面主题君给大家分享一段巨牛逼的SQL,
WordPress批量修改指定分类下所有文章状态!
这个SQL贼牛X哦
UPDATE wp_posts SET post_status = 'draft' WHERE ID IN ( SELECT ID FROM ( SELECT wp_posts.ID FROM wp_posts, wp_term_relationships, wp_term_taxonomy, wp_terms WHERE ID = object_id AND wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id AND post_type = "post" AND post_status = "publish" AND wp_term_relationships.term_taxonomy_id = wp_terms.term_id AND wp_terms.term_id = 7891 AND taxonomy = "category" ) AS a )
使用方法:
进数据库,然后输出查询SQL语句,然后复制上面的SQL语句,最后更换term_id,然后确定!
就这么简单!