Advanced
AdvancedWP-CLI commands

WP-CLI commands

The following WP-CLI commands are available to translate custom posts, taxonomy terms (tags and categories), and media items.

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
--porcelainOutput only the essential information, suitable for parsing by scriptsNo 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"}'

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
--porcelainOutput only the essential information, suitable for parsing by scriptsNo 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"}'

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
--porcelainOutput only the essential information, suitable for parsing by scriptsNo 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"}'