wordpress批量删除指定分类所有文章

文章数量不多,可以直接后台手动删除,如果数量很多,需要执行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 = 18(分类ID)

如果还需删除分类:

delete FROM `wp_term_relationships` where term_taxonomy_id = 18(分类ID)

另外,update更新内容的用法:

UPDATE wp_posts SET post_content = replace( post_content, '原内容','新内容') WHERE option_name = 'home' OR option_name ='siteurl';

本文链接: https://www.168itw.com/wordpress/delete-all-in-category/
转载请注明转载自:168itw

发表评论

您的电子邮箱地址不会被公开。