Bulk remove custom post type and its attachments with wp-cli?

To do this, you could use wp post list and pipe the output into wp post meta delete using xargs.

Here’s an example command to delete the featured images in the meetings post type:


wp post list --post_type= meetings --fields=ID --format=csv | xargs -I % wp post meta delete % _thumbnail_id

You can use wp post meta list on a post to get the names of the fields you wish to delete and modify the command above accordingly.