Skip to content

Manage Post Languages and Translations with AI ​

These tools are available when either WPML or Polylang is active, but not both. Easy MCP AI uses one multilingual provider at a time. Your usual tool choices, connection permissions, and WordPress permissions still apply.

In this article

Inspect languages and existing translations ​

Call wp_list_languages to see the site's language codes, default language, and post types that the multilingual plugin translates. Call wp_get_translations with a post_id to see that post's language, its visible translations, and languages with no translation yet. You need the edit_posts capability to use these tools, and read results also respect your access to each post.

Create or update translated content ​

Use the lang argument with a supported post, page, or custom post type create or update tool to assign its language. To create a translation of an existing post, page, or custom post, also provide translation_of with the original item's ID and include the translated content. These arguments assign a language and link content; they do not translate text for you.

The original and translated items must have the same post type, and the multilingual plugin must translate that post type. A translation group can contain only one post in each language. wp_duplicate_post does not have explicit language arguments, so inspect and update or link a copied item separately if needed.

Call wp_link_translations with translations set to the complete language-code-to-post-ID map for the group you want. For example:

json
{
  "en": 12,
  "de": 48
}

Each key is a language code, and its value is the ID of the post in that language. The tool assigns the listed posts to the submitted group; any posts already linked to them but omitted from the map are unlinked. Before calling it, inspect the existing group and include every translation you want to keep. You must be allowed to edit every affected post.

After linking, call wp_get_translations again to confirm the group. If a write reports that content was saved but the link could not be confirmed, inspect the saved post and its translation group before retrying. Do not create another translation until you know whether the first one was saved.

Was this helpful?