WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to create a single post with title, content and excerpt with this command as it's described in the utility documentation. Could you please show me an example of how to use it? I couldn't find nor in official documentation neither on Google. Thanks!

share|improve this question
github.com/wp-cli/wp-cli/wiki – kaiser Sep 27 '12 at 23:33
There are no examples how to create a post. – Sergei Basharov Sep 28 '12 at 8:00
I never used it, but found it within 20secs.: wp generate posts --count=1000 generates 1k posts for you. Just read yourself please. – kaiser Sep 28 '12 at 12:44
There is also a command wp post create, that's what I am asking about. I don't want to generate dummy posts, I need to create a single post with title, content and excerpt. – Sergei Basharov Sep 28 '12 at 12:59
So then update your post with an info and a link and we start from the beginning. – kaiser Sep 28 '12 at 13:03
up vote 4 down vote accepted

If you type wp help post create you will get all the info you need.


wp post create --post_type=page --post_status=publish --post_title='A new page'
share|improve this answer

If you look at the code for the create method, you'll see that it takes 2 parameters:

    public function create( $args, $assoc_args ) 

$args doesn't seem to be used - $assoc_args is the array passed to the wp_insert_post function from WordPress core. The linked Codex page explains the array parameters.

share|improve this answer

In case you have many post to create, you can create a dedicated folder with all your posts as text documents, using post_title as the txt file titles.

In this very same folder, create a bash file named wp-post-create--loop-files.sh with the following :

for f in $FILES
  echo "Processing $f file..."
  # TEXTFILE = $f
  # take action on each file. $f store current file name
  # cat $TEXTFILE
  wp post create "$f" --post_category=3 --post_title="$f" --user=3 

Then you can create all your posts in a blink by executing sh wp-post-create--loop-files.sh.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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