Kir*_*ash 0 mysql wordpress custom-post-type
我在自定义帖子类型下有大约 2000 个帖子storelocations
。从 WordPress 管理员中删除它们需要花费大量时间。
如何使用 mySQL 命令从数据库中删除此自定义帖子类型的所有帖子。这是我的方法:
DELETE FROM 'wp_posts' WHERE 'post_type' = 'storelocations'
但我想这篇文章可能还有一些数据wp_postmeta
和其他一些表格。我想我也应该从那里删除数据。
那么,我可以知道哪些表有帖子的数据吗?我应该运行什么命令来清除它们。
我的另一个疑问是:与从 mySQL 删除帖子相比,为什么从 WordPress 管理员删除帖子需要花费这么多时间。WordPress 做的事情不就是运行几个 SQL 命令吗?还是有很多事情发生?
DELETE FROM wp_postmeta where post_id IN (SELECT ID from wp_posts where post_type = 'storelocations' );
您也可以选择删除所有评论
DELETE FROM wp_comments where comment_post_ID IN (SELECT ID from wp_posts where post_type = 'storelocations' );
最后,您可以删除所有帖子
DELETE from wp_posts where post_type = 'storelocations'