wp media <command>

Imports files as attachments, regenerates thumbnails, lists registered image sizes.


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

# Import a local image and set it to be the featured image for a post.
$ wp media import ~/Downloads/image.png --post_id=123 --title="A downloaded picture" --featured_image
Success: Imported file '/home/person/Downloads/image.png' as attachment ID 1753 and attached to post 123 as featured image.

Top ↑


Name Description
wp media image-size

List image sizes registered with WordPress.

wp media import

Create attachments from local files or URLs.

wp media regenerate

Regenerate thumbnails for one or more attachments.

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.