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!

  • github.com/wp-cli/wp-cli/wiki
    – kaiser
    Commented Sep 27, 2012 at 23:33
  • There are no examples how to create a post. Commented Sep 28, 2012 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
    Commented Sep 28, 2012 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. Commented Sep 28, 2012 at 12:59
  • So then update your post with an info and a link and we start from the beginning.
    – kaiser
    Commented Sep 28, 2012 at 13:03

3 Answers 3


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'

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.


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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