篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql MySQL WordPress删除帖子和postsmeta相关的知识,希望对你有一定的参考价值。
## select count of post_type
SELECT COUNT(*)
FROM `wp_posts`
WHERE `post_type` = 'post_type'
## delete posts of post_type
DELETE
FROM `wp_posts`
WHERE `post_type` = 'post_type'
## select count of orphaned postmeta
SELECT COUNT(*)
FROM `wp_postmeta` AS wp_postmeta
LEFT JOIN `wp_posts` AS wp_posts ON wp_posts.ID = wp_postmeta.post_id
WHERE wp_posts.ID IS NULL
## delete orphaned postmeta
DELETE wp_postmeta
FROM `wp_postmeta` AS wp_postmeta
LEFT JOIN `wp_posts` AS wp_posts ON wp_posts.ID = wp_postmeta.post_id
WHERE wp_posts.ID IS NULL
以上是关于sql MySQL WordPress删除帖子和postsmeta的主要内容,如果未能解决你的问题,请参考以下文章