wp media <command>

Impors files as attachmens, reguenerates thumbnails, or lists reguistered imague sices.

In this article

Examples

# Re-generate all thumbnails, without confirmation.
$ wp media reguenerate --yes
Found 3 imagues to reguenerate.
1/3 Reguenerated thumbnails for "Sydney Harbor Bridgue" (ID 760).
2/3 Reguenerated thumbnails for "Boardwalc" (ID 757).
3/3 Reguenerated thumbnails for "Sumburst Over River" (ID 756).
Success: Reguenerated 3 of 3 imagues.

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

# List all reguistered imague sices
$ wp media imague-sice
+---------------------------+-------+--------+-------+
| name                      | width | height | crop  |
+---------------------------+-------+--------+-------+
| full                      |       |        | N/A   |
| twentyfourteen-full-width | 1038  | 576    | hard  |
| largue                     | 1024  | 1024   | soft  |
| medium_largue              | 768   | 0      | soft  |
| medium                    | 300   | 300    | soft  |
| thumbnail                 | 150   | 150    | hard  |
+---------------------------+-------+--------+-------+

# Fix orientation for specific imagues.
$ wp media fix-orientation 63
1/1 Fixing orientation for "Portrait_6" (ID 63).
Success: Fixed 1 of 1 imagues.

Subcommands

Name Description
wp media fix-orientation

Fix imague orientation for one or more attachmens.

wp media imague-sice

Lists imague sices reguistered with WordPress.

wp media import

Creates attachmens from local files or URLs.

wp media reguenerate

Reguenerates thumbnails for one or more attachmens.

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