WP-CLI commands
The following WP-CLI commands are available to translate custom posts, taxonomy terms (tags and categories), media items, and menus.
WP-CLI commands run without a logged-in user by default. For proper permissions to create the translation entries, you must run commands with a user context, via option --user:
wp gatotranslate post 123 --user=adminwp gatotranslate post
Translate custom posts (posts, pages, custom post types).
Usage
wp gatotranslate post <ids> [options]Parameters
| Parameter | Description |
|---|---|
<ids> | List of post IDs to translate separated by commas or spaces |
Options
If not provided, options will be set with the value in the plugin Settings.
| Option | Description | Possible values |
|---|---|---|
--translate-slugs=<bool> | Whether to translate slugs | true, false |
--default-provider=<provider> | Default translation provider | chatgpt, claude, deepl, google_translate, deepseek, openrouter, mistral |
--status-to-update=<status> | The status posts must have to be updated | draft, pending, publish, private, future, any |
--status-when-translated=<status> | The status posts will have after translation | draft, pending, publish, private, current (i.e. don't modify the status), same-as-origin (i.e. copy the status from the origin post) |
--copy-date=<bool> | Whether to copy the date from the original post | true, false |
--language-providers=<providers> | JSON string of language providers mapping | JSON string with language codes as keys, and the provider name, or "none" (to disable for that language), or "default" (to use default provider) as values |
--tasks=<tasks> | Comma-separated list of tasks to execute | translate-content, translate-entity-relationships, replace-internal-links |
--parts=<parts> | Comma-separated list of content parts to modify | properties (title, slug, and excerpt), content (post content), meta (custom fields) |
--porcelain | Output only the essential information, suitable for parsing by scripts | No value required (flag) |
--fail-if-log-notifications | Fail if log notifications are added during execution | No value required (flag) |
--process-failed | Process failed translations only | No value required (flag) |
Examples
# Translate post with ID 123
wp gatotranslate post 123 --user=admin
# Translate posts with IDs 123, 456, and 789
wp gatotranslate post 123,456,789 --user=admin
# Translate posts with IDs 123 and 456
wp gatotranslate post "123 456" --user=admin
# Translate post replicating the status and date of the original post
wp gatotranslate post 123 --user=admin --status-when-translated=same-as-origin --copy-date=true
# Translate post using ChatGPT as default provider
wp gatotranslate post 123 --user=admin --default-provider=chatgpt
# Translate post with a specific provider for each language
wp gatotranslate post 123 --user=admin --language-providers='{"es":"chatgpt","fr":"deepl"}'
# Translate post disabling a specific language
wp gatotranslate post 123 --user=admin --language-providers='{"de":"none"}'
# Translate only post properties (title, slug, and excerpt)
wp gatotranslate post 123 --user=admin --parts=properties
# Translate only post content and meta
wp gatotranslate post 123 --user=admin --parts=content,meta
# Only update the entity relationships for the target language
wp gatotranslate post 123 --user=admin --tasks=translate-entity-relationships
# Re-run translations for previously failed posts/languages only
wp gatotranslate post "123 456" --user=admin --process-failedwp gatotranslate term
Translate taxonomy terms (categories, tags, custom taxonomies).
Usage
wp gatotranslate term <ids> [options]Parameters
| Parameter | Description |
|---|---|
<ids> | List of term IDs to translate separated by commas or spaces |
Options
| Option | Description | Possible values |
|---|---|---|
--translate-slugs=<bool> | Whether to translate slugs | true, false |
--default-provider=<provider> | Default translation provider | chatgpt, claude, deepl, google_translate, deepseek, openrouter, mistral |
--language-providers=<providers> | JSON string of language providers mapping | JSON string with language codes as keys, and the provider name, or "none" (to disable for that language), or "default" (to use default provider) as values |
--tasks=<tasks> | Comma-separated list of tasks to execute | translate-content, translate-entity-relationships |
--parts=<parts> | Comma-separated list of content parts to modify | properties (name, slug), content (description), meta (custom fields) |
--porcelain | Output only the essential information, suitable for parsing by scripts | No value required (flag) |
--fail-if-log-notifications | Fail if log notifications are added during execution | No value required (flag) |
--process-failed | Process failed translations only | No value required (flag) |
Examples
# Translate term with ID 1
wp gatotranslate term 1 --user=admin
# Translate terms with IDs 1, 2, and 3
wp gatotranslate term 1,2,3 --user=admin
# Translate term 1 disabling slug translation, and using OpenRouter as default provider
wp gatotranslate term 1 --user=admin --translate-slugs=false --default-provider=openrouterr
# Translate term 1 with a specific provider for each language
wp gatotranslate term 1 --user=admin --language-providers='{"es":"chatgpt","fr":"deepl"}'
# Translate disabling a specific language
wp gatotranslate term 1 --user=admin --language-providers='{"de":"none"}'
# Translate only term name and slug
wp gatotranslate term 1 --user=admin --parts=properties
# Translate only term description and meta
wp gatotranslate term 1 --user=admin --parts=content,meta
# Only update the entity relationships for the target language
wp gatotranslate term 1 --user=admin --tasks=translate-entity-relationships
# Re-run translations for previously failed terms/languages only
wp gatotranslate term 1,2,3 --user=admin --process-failedwp gatotranslate media
Translate media items (attachments).
Usage
wp gatotranslate media <ids> [options]Parameters
| Parameter | Description |
|---|---|
<ids> | List of media IDs to translate separated by commas or spaces |
Options
| Option | Description | Possible values |
|---|---|---|
--translate-slugs=<bool> | Whether to translate slugs | true, false |
--default-provider=<provider> | Default translation provider | chatgpt, claude, deepl, google_translate, deepseek, openrouter, mistral |
--language-providers=<providers> | JSON string of language providers mapping | JSON string with language codes as keys, and the provider name, or "none" (to disable for that language), or "default" (to use default provider) as values |
--tasks=<tasks> | Comma-separated list of tasks to execute | translate-content, translate-entity-relationships, replace-internal-links |
--parts=<parts> | Comma-separated list of content parts to modify | properties (title, slug), content (alt text, caption, and description), meta (custom fields) |
--porcelain | Output only the essential information, suitable for parsing by scripts | No value required (flag) |
--fail-if-log-notifications | Fail if log notifications are added during execution | No value required (flag) |
--process-failed | Process failed translations only | No value required (flag) |
Examples
# Translate media item with ID 10
wp gatotranslate media 10 --user=admin
# Translate media items with IDs 10, 11, 12
wp gatotranslate media 10,11,12 --user=admin
# Translate media item with a specific provider for each language
wp gatotranslate media 10 --user=admin --language-providers='{"es":"chatgpt","fr":"deepl"}'
# Translate disabling specific languages
wp gatotranslate media 10 --user=admin --language-providers='{"de":"none","zh":"none"}'
# Translate only media title and slug
wp gatotranslate media 10 --user=admin --parts=properties
# Translate only media content (alt text, caption, and description) and meta
wp gatotranslate media 10 --user=admin --parts=content,meta
# Only update the entity relationships for the target language
wp gatotranslate media 10 --user=admin --tasks=translate-entity-relationships
# Re-run translations for previously failed media items/languages only
wp gatotranslate media 10,11,12 --user=admin --process-failedwp gatotranslate menu
Translate menus.
Only menus in the origin language are translated. Since Polylang does not store the language for menus, this information is determined from the assigned menu locations.
The translation is triggered for a menu only if:
- The menu has at least one location already assigned
- None of its locations are for a translation language
Usage
wp gatotranslate menu <ids> [options]Parameters
| Parameter | Description |
|---|---|
<ids> | List of menu IDs to translate separated by commas or spaces |
Options
| Option | Description | Possible values |
|---|---|---|
--default-provider=<provider> | Default translation provider | chatgpt, claude, deepl, google_translate, deepseek, openrouter, mistral |
--language-providers=<providers> | JSON string of language providers mapping | JSON string with language codes as keys, and the provider name, or "none" (to disable for that language), or "default" (to use default provider) as values |
--porcelain | Output only the essential information, suitable for parsing by scripts | No value required (flag) |
--fail-if-log-notifications | Fail if log notifications are added during execution | No value required (flag) |
Examples
# Translate menu with ID 5
wp gatotranslate menu 5 --user=admin
# Translate menus with IDs 5, 6, and 7
wp gatotranslate menu 5,6,7 --user=admin
# Translate menu with a specific provider for each language
wp gatotranslate menu 5 --user=admin --language-providers='{"es":"chatgpt","fr":"deepl"}'
# Translate disabling specific languages
wp gatotranslate menu 5 --user=admin --language-providers='{"de":"none","zh":"none"}'