您可以通过删除所有帖子$wpdb
DELETE FROM wp_posts WHERE post_type=\'post_type\';
DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT id FROM wp_posts);
DELETE FROM wp_term_relationships WHERE object_id NOT IN (SELECT id FROM wp_posts)
或者使用此查询将其替换为{您的CPT}}和您的自定义帖子类型
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b
ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c
ON (a.ID = c.post_id)
WHERE a.post_type = \'{{your CPT}}\';