I would like to generate a number of posts and attach the same featured image to all posts.

wp post generate --count=20
wp post meta add <id> _thumbnail_id 215

But how can I run this two commands together? How can I retrieve the id of created post?

1 Answer 1


As I mentioned on the Github issue, your request isn't currently possible with WP-CLI but would be a nice future enhancement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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