admin管理员组文章数量:1122846
The following code updates the post status of standard wordpress posts to 'Archived'.
UPDATE wp_posts SET post_status = 'Archived' WHERE post_status != 'static';
How can I make this only affect custom post types with the slug of 'cpt_operator'. I know I can do this from Wp-Admin but with over 2,500 posts its a huge task.
The following code updates the post status of standard wordpress posts to 'Archived'.
UPDATE wp_posts SET post_status = 'Archived' WHERE post_status != 'static';
How can I make this only affect custom post types with the slug of 'cpt_operator'. I know I can do this from Wp-Admin but with over 2,500 posts its a huge task.
Share Improve this question asked Nov 9, 2016 at 12:01 JamesJames 2483 silver badges14 bronze badges2 Answers
Reset to default 2If you mean post type instead of slug I'd say...
UPDATE wp_posts
SET post_status = 'archived'
WHERE post_status <> 'static'
AND post_type = 'cpt_operator';
But be careful when editing the db directly!
Use this to delte posts with time line:
UPDATE `wp97_posts` SET post_status="archive" WHERE post_date < '2023-05-30 19:15:27' AND post_status="publish";
本文标签: databaseBulk Update of Custom Post Type Post Status through SQL
版权声明:本文标题:database - Bulk Update of Custom Post Type Post Status through SQL 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305628a1932658.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论