Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ wp media
1/1 Fixing orientation for "Portrait_6" (ID 63).
Success: Fixed 1 of 1 images.

# Remove all generated thumbnails, without confirmation.
$ wp media prune --yes
Found 3 images to prune.
1/3 Pruned thumbnails for "Sydney Harbor Bridge" (ID 760).
2/3 Pruned thumbnails for "Boardwalk" (ID 757).
3/3 Pruned thumbnails for "Sunburst Over River" (ID 756).
Success: Pruned 3 of 3 images.



### wp media fix-orientation
Expand Down Expand Up @@ -183,6 +191,62 @@ wp media import <file>... [--post_id=<post_id>] [--post_name=<post_name>] [--fil



### wp media prune

Removes all generated image files for one or more attachments.

~~~
wp media prune [<attachment-id>...] [--image_size=<image_size>...] [--remove-abandoned] [--yes]
~~~

Generated image files for registered sizes can be recreated with
`wp media regenerate`. Thumbnails for image sizes that are no longer
registered are kept by default because they cannot be regenerated; use
`--remove-abandoned` to remove them as well.

**OPTIONS**

[<attachment-id>...]
One or more IDs of the attachments to prune.

[--image_size=<image_size>...]
Name of the image size to remove. Repeat the flag to specify multiple. Only thumbnails of specified image size(s) will be removed, thumbnails of other image sizes will not.

[--remove-abandoned]
Also remove thumbnails for image sizes that are no longer registered.

[--yes]
Answer yes to the confirmation message. Confirmation only shows when no IDs passed as arguments.

**EXAMPLES**

# Remove all generated thumbnails for all images, without confirmation.
$ wp media prune --yes
Found 3 images to prune.
1/3 Pruned thumbnails for "Sydney Harbor Bridge" (ID 760).
2/3 Pruned thumbnails for "Boardwalk" (ID 757).
3/3 Pruned thumbnails for "Sunburst Over River" (ID 756).
Success: Pruned 3 of 3 images.

# Remove only the "large" thumbnails for all images.
$ wp media prune --image_size=large
Do you really want to prune the "large" image size for all images? [y/n] y
Found 3 images to prune.
1/3 Pruned thumbnails for "Sydney Harbor Bridge" (ID 760).
2/3 Pruned thumbnails for "Boardwalk" (ID 757).
3/3 Pruned thumbnails for "Sunburst Over River" (ID 756).
Success: Pruned 3 of 3 images.

# Remove all thumbnails including those for unregistered sizes.
$ wp media prune --remove-abandoned --yes
Found 3 images to prune.
1/3 Pruned thumbnails for "Sydney Harbor Bridge" (ID 760).
2/3 Pruned thumbnails for "Boardwalk" (ID 757).
3/3 Pruned thumbnails for "Sunburst Over River" (ID 756).
Success: Pruned 3 of 3 images.



### wp media regenerate

Regenerates thumbnails for one or more attachments.
Expand Down Expand Up @@ -337,6 +401,10 @@ Want to contribute a new feature? Please first [open a new issue](https://github

Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally.

### License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Support

GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
Expand Down