diff --git a/docs/cli/index.md b/docs/cli/index.md new file mode 100644 index 00000000..dcfa5719 --- /dev/null +++ b/docs/cli/index.md @@ -0,0 +1,40 @@ +# CLI + +TinyPNG provides several CLI commands allowing you to automate actions on your website. + +## Commands + +### `wp tiny optimize` + +Optimizes images in the WordPress media library. +When run without arguments, all images that have not yet been optimized are processed. You can also target specific attachments by providing a comma-separated list of attachment IDs. + +**Options** + +| Option | Description | +|---|---| +| `--attachments=` | Comma-separated list of attachment IDs to optimize. Omit to optimize all unoptimized images. | + +**Examples** + +Optimize all unoptimized images: + +```bash +wp tiny optimize +``` + +Optimize specific attachments by ID: + +```bash +wp tiny optimize --attachments=532,603,705 +``` + +**Output** + +Skipped attachments (invalid or unsupported file types) are reported as warnings. When finished, a summary shows how many images were successfully optimized. + +``` +Optimizing 3 images. +Optimizing images: 100% (3 of 3) +Success: Done! Optimized 3 of 3 images. +``` diff --git a/docs/index.md b/docs/index.md index b20ecad0..2e72381e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,3 +7,4 @@ Welcome to the developer documentation of the Tinify WordPress plugin. - [Hooks](hooks/index.md) - [Actions](hooks/index.md#actions) - [Filters](filters/index.md#filters) +- [CLI](cli/index.md)