I have a custom post type called "meetings" and I will like to bulk remove all the posts and all of its attachment images...

Can this be done with the wp-cli?

thank you!

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.

  • Hi Dave, thank you, but this is not really what Im looking for, I need to delete the all "meetings" posts and their attachments, ideas? – Brooke Jul 17 at 21:52

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.