Skip to content
Merged
Show file tree
Hide file tree
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
40 changes: 40 additions & 0 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
@@ -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=<ids>` | 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.
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading