meta set
Destructive
This command writes to your WordPress database. Use --dry-run to preview first.
Usage
seo-ops meta set <post-id> <field> <value> [--path=<path>] [--dry-run]
seo-ops meta set <post-id> --title="..." --description="..." [--path=<path>] [--dry-run]
seo-ops meta set <id1,id2,...> <field> <value> [--path=<path>] [--dry-run]
Set SEO meta fields. Supports positional syntax, named argument syntax, and comma-separated post IDs.
Examples
Positional Syntax
seo-ops meta set 123 title "My New SEO Title" --path=/var/www/html
Output:
Post 123: title updated successfully
Named Argument Syntax (Multiple Fields)
seo-ops meta set 123 --title="New Title" --description="New description" --path=/var/www/html
Output:
Post 123: title updated
Post 123: description updated
Comma-Separated Post IDs
seo-ops meta set 123,456,789 title "Bulk Title" --path=/var/www/html
Output:
Post 123: title updated
Post 456: title updated
Post 789: title updated
Dry-Run (Preview Only)
seo-ops meta set 123 title "New Title" --path=/var/www/html --dry-run
Output:
DRY RUN: Would set title for post 123 to "New Title"
Original value: "My New SEO Title"
New value: "New Title"
No database changes were made.
Field Validation
| Field | Validation |
|---|---|
| noindex | Must be 0, 1, yes, no, true, or false |
| canonical | Must start with http:// or https:// |
| focus_keyword | Max 191 characters |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Invalid path, field validation error |
| 2 | Missing argument |
| 4 | WordPress path not configured |