| 开发者 | timonf |
|---|---|
| 更新时间 | 2026年8月21日 04:04 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.1 |
| 版权: | MIT |
| 版权网址: | 版权信息 |
?trp-edit-translation pages.
The language plugin (Polylang, WP Multilang, WPGlobus, or TranslatePress) handles the translated post as it normally would — SlyTranslate creates or updates the translated entry and lets the language plugin own the relationship.
Workflow 2 — Inline Gutenberg translation (block or selected text)
Translate content while writing, without touching a language plugin or a full-post workflow.
Requirements: configured AI Connector
Select any text in a Gutenberg block and the block toolbar gains a Translate button. The selected text is replaced with the translation in place. When no text is selected, the button translates the entire block.
This workflow is self-contained: it does not require a language plugin and does not create or modify translated post entries. It is useful for one-off corrections, translating imported content on the fly, or working in a single-language site where you just need AI rewriting in another language.
Workflow 3 — LLM wrapper via MCP (Claude Code, Codex, and others)
Drive WordPress translations from inside your LLM tool of choice.
Requirements: language plugin + WordPress application password (token) + WordPress MCP Adapter plugin
When a WordPress MCP Adapter is active, SlyTranslate registers its abilities over MCP. Any MCP-capable LLM client — Claude Code, Codex, custom agents — can then discover and call them.
In this workflow the LLM wrapper provides the translation itself. SlyTranslate's MCP abilities handle the WordPress side: reading content structure, checking translation status, writing translated entries, and coordinating with the language plugin. No WordPress AI Connector is needed because translation is performed by the external model, not by WordPress.
A typical agent session:
ai-translate/get-languages to find valid target language codes.ai-translate/get-translation-status on the source post to read source_language and single_entry_mode.ai-translate/translate-content to write the translated entry.ai-translate/get-languages — List languages exposed by the active language plugin
ai-translate/get-translation-status — Show translation status for a content item, including source_language and single_entry_mode
ai-translate/set-post-language — Change the language assignment of an existing content item (Polylang only)
ai-translate/get-untranslated — Find content still missing a target translation
ai-translate/translate-text — Translate arbitrary text
ai-translate/translate-blocks — Translate serialized Gutenberg blocks
ai-translate/translate-content — Create or update one translated post/page/CPT entry
ai-translate/translate-content-bulk — Bulk-translate multiple entries (set background=true to queue the batch via Action Scheduler/WP-Cron and poll it with get-progress)
ai-translate/translate-terms — Bulk-translate taxonomy terms and link them as translations (Polylang only)
ai-translate/get-translatable-fields — Introspect which meta fields a translation would translate or clear, with source attribution (manual/SEO/ACF/default/filter)
ai-translate/get-progress — Return live progress for a running translation or a queued background job (job_id)
ai-translate/cancel-translation — Cancel a running translation or a queued background job (job_id)
ai-translate/get-available-models — List models from configured connectors
ai-translate/save-additional-prompt — Save per-user additional instructions
ai-translate/configure — Read or update persistent plugin settings
MCP call sequence
For reliable results in agent workflows:
get-languages first when the correct target language code is unknown.get-translation-status before translate-content to read source_language, single_entry_mode, and whether a translation already exists.source_language unless you intentionally pin a source variant.overwrite=true only when status or prior context confirms a target-language entry already exists.translated_post_id equals source_post_id in single-entry adapters (WP Multilang, WPGlobus, TranslatePress). In multi-post adapters (Polylang) the translated item has a sibling post ID.chat_template_kwargs support via direct_api_urlslytranslate_model_profiles filter.
slytranslate directory to /wp-content/plugins/.Yes. When Advanced Custom Fields (Free or Pro) is active, SlyTranslate automatically detects text, textarea, and wysiwyg fields on the post being translated and includes them in the translation — no settings to configure. Fields of other types (image, number, url, select, relationships, etc.) are left untouched.
This includes Repeater and Flexible Content layouts: each leaf field with a translatable type is picked up individually, regardless of nesting depth.
To extend which field types are translated, add a filter to your theme's functions.php or a site-specific plugin:
add_filter( 'slytranslate_acf_translatable_field_types', function ( $types ) { $types[] = 'url'; return $types; } );
To exclude fields there are three options: enable the "Exclude from AI translation" toggle in the ACF field editor, add the meta keys to the meta_keys_exclude setting (via the configure MCP ability), or use the slytranslate_translate_meta_key filter, which has the final say:
add_filter( 'slytranslate_translate_meta_key', function ( $translate, $meta_key ) { return $meta_key === 'my_field' ? false : $translate; }, 10, 2 );
Yes. Field data stored inside acf/* Gutenberg blocks is translated automatically along with the post content, including repeater sub-fields. ACF link fields translate only the link title — URL and target are never sent to the model.
ACF fields on options pages are translated through the ai-translate/translate-options MCP ability. With WPGlobus or WP Multilang the translated variant is merged into the option value; TranslatePress needs no separate step (its string table already translates option output). Polylang has no language-aware option storage — opt in to per-language storage via the slytranslate_acf_options_post_id filter.
Yes. Translatable field types (text, textarea, wysiwyg for Meta Box; text, paragraph, wysiwyg for Pods) are detected through each plugin's field registry. The type lists are extensible via the slytranslate_metabox_translatable_field_types and slytranslate_pods_translatable_field_types filters.
Yes, for inline text and block translation. Content translation workflows (full post/page) require a supported language plugin.
In WordPress Settings > Connectors, not inside SlyTranslate.
Yes. Select items in wp-admin, pick the bulk translation action, choose language and model, and confirm.
Yes. Call ai-translate/translate-content-bulk with background=true and the batch is queued with one post per scheduled action — via Action Scheduler when available (bundled by WooCommerce), otherwise via WP-Cron. Poll with get-progress (job_id) and cancel with cancel-translation (job_id). Jobs survive closed browser tabs and PHP timeouts. Without a working cron the browser-driven mode keeps working as before.
With Polylang, enable translate_terms in ai-translate/configure: terms without a target-language translation are then created and linked automatically during post translation instead of being dropped. For existing sites, ai-translate/translate-terms bulk-translates whole taxonomies (use dry_run=true to preview).
Yes. Alt texts embedded in the content are translated with the content. The attachment meta alt text (_wp_attachment_image_alt) is translated by default, and with Polylang's media translation enabled, duplicating a media item also translates its alt text, caption, and description.
Yes. Configure the glossary setting via ai-translate/configure: entries with mode=keep are never translated; entries with mode=translate always use your fixed per-language translation.
Yes. Enable auto_translate_new in ai-translate/configure. Publishing a post in the source language queues draft translations for all missing target languages in the background — they are never auto-published, so editorial review stays in place.
Yes. On pages opened with ?trp-edit-translation=true, SlyTranslate adds a sidebar panel with the same model, overwrite, progress, and cancel controls used elsewhere.
In the list-table dialog, overwrite is off by default. If a translation already exists you must enable it and confirm before the translation starts.
Yes, when using Polylang. Call ai-translate/set-post-language with post_id and target_language. Use force to bypass conflict checks and relink=true to rewrite translation relations. Not available in WP Multilang mode.
Use the settings page (Settings → SlyTranslate) or ai-translate/configure for persistent defaults — both write through the same backend. Pass additional_prompt on any translate-* call for per-request instructions.
Some external WordPress MCP adapter wrappers expose a flatter execute-ability signature. If discover-abilities shows the correct SlyTranslate schema but execute-ability still errors about a missing parameters wrapper, investigate the external adapter layer — SlyTranslate controls ability names, descriptions, and schemas, not the wrapper surface.
Any LLM from a WordPress AI connector works without configuration. Built-in dedicated profiles exist for: TranslateGemma, TowerInstruct, Salamandra, Nvidia Nemotron, Qwen 3.x, GLM-4.6v, Gemma 4, Phi-4, EuroLLM, Llama 3.1-8B, SauerkrautLM, Ministral-3, and Ministral-8B. Additional profiles can be registered via the slytranslate_model_profiles filter.