Advanced
AdvancedWP-CLI commands

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=admin

wp gatotranslate post

Translate custom posts (posts, pages, custom post types).

Usage

wp gatotranslate post <ids> [options]

Parameters

ParameterDescription
<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.

OptionDescriptionPossible values
--translate-slugs=<bool>Whether to translate slugstrue, false
--default-provider=<provider>Default translation providerchatgpt, claude, deepl, google_translate, deepseek, openrouter, mistral
--status-to-update=<status>The status posts must have to be updateddraft, pending, publish, private, future, any
--status-when-translated=<status>The status posts will have after translationdraft, 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 posttrue, false
--language-providers=<providers>JSON string of language providers mappingJSON 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 executetranslate-content, translate-entity-relationships, replace-internal-links
--parts=<parts>Comma-separated list of content parts to modifyproperties (title, slug, and excerpt), content (post content), meta (custom fields)
--porcelainOutput only the essential information, suitable for parsing by scriptsNo value required (flag)
--fail-if-log-notificationsFail if log notifications are added during executionNo value required (flag)
--process-failedProcess failed translations onlyNo 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-failed

wp gatotranslate term

Translate taxonomy terms (categories, tags, custom taxonomies).

Usage

wp gatotranslate term <ids> [options]

Parameters

ParameterDescription
<ids>List of term IDs to translate separated by commas or spaces

Options

OptionDescriptionPossible values
--translate-slugs=<bool>Whether to translate slugstrue, false
--default-provider=<provider>Default translation providerchatgpt, claude, deepl, google_translate, deepseek, openrouter, mistral
--language-providers=<providers>JSON string of language providers mappingJSON 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 executetranslate-content, translate-entity-relationships
--parts=<parts>Comma-separated list of content parts to modifyproperties (name, slug), content (description), meta (custom fields)
--porcelainOutput only the essential information, suitable for parsing by scriptsNo value required (flag)
--fail-if-log-notificationsFail if log notifications are added during executionNo value required (flag)
--process-failedProcess failed translations onlyNo 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-failed

wp gatotranslate media

Translate media items (attachments).

Usage

wp gatotranslate media <ids> [options]

Parameters

ParameterDescription
<ids>List of media IDs to translate separated by commas or spaces

Options

OptionDescriptionPossible values
--translate-slugs=<bool>Whether to translate slugstrue, false
--default-provider=<provider>Default translation providerchatgpt, claude, deepl, google_translate, deepseek, openrouter, mistral
--language-providers=<providers>JSON string of language providers mappingJSON 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 executetranslate-content, translate-entity-relationships, replace-internal-links
--parts=<parts>Comma-separated list of content parts to modifyproperties (title, slug), content (alt text, caption, and description), meta (custom fields)
--porcelainOutput only the essential information, suitable for parsing by scriptsNo value required (flag)
--fail-if-log-notificationsFail if log notifications are added during executionNo value required (flag)
--process-failedProcess failed translations onlyNo 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-failed

wp 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

ParameterDescription
<ids>List of menu IDs to translate separated by commas or spaces

Options

OptionDescriptionPossible values
--default-provider=<provider>Default translation providerchatgpt, claude, deepl, google_translate, deepseek, openrouter, mistral
--language-providers=<providers>JSON string of language providers mappingJSON 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
--porcelainOutput only the essential information, suitable for parsing by scriptsNo value required (flag)
--fail-if-log-notificationsFail if log notifications are added during executionNo 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"}'