I regularly need to create a batch of posts of a custom post type, with names and meta values that follow a regular pattern. This seems like a perfect canditate for using wp-cli, but so far it hasn't worked.

Using wp-cli, if I enter:

wp post create --post_title='test' --post_status='draft' post_type='class_notes'

I get an error:

Unable to read content from 'post_type=class_notes'.

However wp-cli is definitely able to connect to this post type, as the following returns a proper list of labels and capabilities:

wp post-type get 'class_notes'

Is it the case that I simply cannot create a post with a custom post type using wp-cli?


It should probably be

wp post create --post_title='test' --post_status='draft' --post_type='class_notes'

(note the two -- that mark it as a command option)

  • Ah, you got it. Thanks so much. My face is a little red now. – Kit Johnson Sep 17 '18 at 4:07

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.