You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removes all generated image files for one or more attachments.
197
+
198
+
~~~
199
+
wp media prune [<attachment-id>...] [--image_size=<image_size>...] [--remove-abandoned] [--yes]
200
+
~~~
201
+
202
+
Generated image files for registered sizes can be recreated with
203
+
`wp media regenerate`. Thumbnails for image sizes that are no longer
204
+
registered are kept by default because they cannot be regenerated; use
205
+
`--remove-abandoned` to remove them as well.
206
+
207
+
**OPTIONS**
208
+
209
+
[<attachment-id>...]
210
+
One or more IDs of the attachments to prune.
211
+
212
+
[--image_size=<image_size>...]
213
+
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.
214
+
215
+
[--remove-abandoned]
216
+
Also remove thumbnails for image sizes that are no longer registered.
217
+
218
+
[--yes]
219
+
Answer yes to the confirmation message. Confirmation only shows when no IDs passed as arguments.
220
+
221
+
**EXAMPLES**
222
+
223
+
# Remove all generated thumbnails for all images, without confirmation.
224
+
$ wp media prune --yes
225
+
Found 3 images to prune.
226
+
1/3 Pruned thumbnails for "Sydney Harbor Bridge" (ID 760).
227
+
2/3 Pruned thumbnails for "Boardwalk" (ID 757).
228
+
3/3 Pruned thumbnails for "Sunburst Over River" (ID 756).
229
+
Success: Pruned 3 of 3 images.
230
+
231
+
# Remove only the "large" thumbnails for all images.
232
+
$ wp media prune --image_size=large
233
+
Do you really want to prune the "large" image size for all images? [y/n] y
234
+
Found 3 images to prune.
235
+
1/3 Pruned thumbnails for "Sydney Harbor Bridge" (ID 760).
236
+
2/3 Pruned thumbnails for "Boardwalk" (ID 757).
237
+
3/3 Pruned thumbnails for "Sunburst Over River" (ID 756).
238
+
Success: Pruned 3 of 3 images.
239
+
240
+
# Remove all thumbnails including those for unregistered sizes.
241
+
$ wp media prune --remove-abandoned --yes
242
+
Found 3 images to prune.
243
+
1/3 Pruned thumbnails for "Sydney Harbor Bridge" (ID 760).
244
+
2/3 Pruned thumbnails for "Boardwalk" (ID 757).
245
+
3/3 Pruned thumbnails for "Sunburst Over River" (ID 756).
246
+
Success: Pruned 3 of 3 images.
247
+
248
+
249
+
186
250
### wp media regenerate
187
251
188
252
Regenerates thumbnails for one or more attachments.
@@ -337,6 +401,10 @@ Want to contribute a new feature? Please first [open a new issue](https://github
337
401
338
402
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.
339
403
404
+
### License
405
+
406
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
407
+
340
408
## Support
341
409
342
410
GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
0 commit comments