Skip to content

Commit

Permalink
Merge pull request #2713 from wp-cli/media-import-assign-multi
Browse files Browse the repository at this point in the history
Document how to import an attachment and assign multiple thumbnails
  • Loading branch information
danielbachhuber committed May 2, 2016
2 parents 18e12f4 + c863051 commit 3de6ec9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions php/commands/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ function regenerate( $args, $assoc_args = array() ) {
* # Import a local image and set it to be the post thumbnail for a post
* wp media import ~/Downloads/image.png --post_id=123 --title="A downloaded picture" --featured_image
*
* # Import a local image, but set it as the featured image for all posts
* # 1. Import the image and get its attachment ID
* * 2. Assign the attachment ID as the featured image for all posts
* ATTACHMENT_ID="$(wp media import ~/Downloads/image.png --porcelain)"
* wp post list --post_type=post --format=ids | xargs -0 -d ' ' -I % wp post meta add % _thumbnail_id $ATTACHMENT_ID
*
* # Import an image from the web
* wp media import http://s.wordpress.org/style/images/wp-header-logo.png --title='The WordPress logo' --alt="Semantic personal publishing"
*/
Expand Down

0 comments on commit 3de6ec9

Please sign in to comment.