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
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This package implements the following commands:

### wp media

Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
Imports files as attachments, regenerates thumbnails, replaces existing attachment files, or lists registered image sizes.

~~~
wp media
Expand Down Expand Up @@ -336,6 +336,46 @@ wp media regenerate [<attachment-id>...] [--image_size=<image_size>...] [--skip-



### wp media replace

Replaces the file for an existing attachment while preserving its identity.

~~~
wp media replace <attachment-id> <file> [--skip-delete] [--porcelain]
~~~

**OPTIONS**

<attachment-id>
ID of the attachment whose file is to be replaced.

<file>
Path to the replacement file. Supports local paths and URLs.

[--skip-delete]
Skip deletion of old thumbnail files after replacement.

[--porcelain]
Output just the attachment ID after replacement.

**EXAMPLES**

# Replace an attachment file with a local file.
$ wp media replace 123 ~/new-image.jpg
Replaced file for attachment ID 123 with '/home/user/new-image.jpg'.
Success: Replaced 1 of 1 images.

# Replace an attachment file with a file from a URL.
$ wp media replace 123 'http://example.com/image.jpg'
Replaced file for attachment ID 123 with 'http://example.com/image.jpg'.
Success: Replaced 1 of 1 images.

# Replace and output just the attachment ID.
$ wp media replace 123 ~/new-image.jpg --porcelain
123



### wp media image-size

Lists image sizes registered with WordPress.
Expand Down