sql wordpress将某一个分类下所有文章变成等待复审
要将WordPress中某一个分类下的所有文章设置为等待复审,您可以使用以下SQL查询语句:
UPDATE wp_posts
SET post_status = 'pending'
WHERE post_type = 'post'
AND post_status = 'publish'
AND ID IN (
SELECT object_id
FROM wp_term_relationships
WHERE term_taxonomy_id = (
SELECT term_taxonomy_id
FROM wp_term_taxonomy
WHERE taxonomy = 'category'
AND term_id = {category_id}
)
);
请注意,上述代码中的 {category_id} 需要替换为您要操作的分类的ID。
此SQL查询将更新 wp_posts 表中所有满足以下条件的文章:
post_type 为 'post'(文章类型为文章),
post_status 为 'publish'(文章状态为已发布),
属于指定分类ID的文章。
将这些文章的 post_status 设置为 'pending'(等待复审)。
在执行此操作之前,请务必备份您的数据库以防止数据丢失,并在生产环境之前进行测试。
☛云炬网络十万资源站