A post created through the REST API or an import often has no language at all, so it never shows up in the language switcher.
content/set-post-language assigns the language through the multilingual plugin itself.
At a glance
| Ability | content/set-post-language |
| Toolset | Content — toolset/content |
| Group | Translations › Posts |
| Requires | Polylang or WPML, active on the site |
| Capability | manage_options |
| Safety | Writes data |
| Repeatable | Idempotent — running it twice leaves the same result |
| Ships in | AcrossAI Abilities Manager 0.1.0 and later |
How it works
Pass the post_id and the language code, such as fr or de.
With Polylang it calls pll_set_post_language(); with WPML it uses the wpml_set_element_language_details action. The result names which one it used.
It only sets the language. To connect the post to its other-language versions, link them as translations.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
post_id | integer | Yes | The post or page ID. |
language | string | Yes | The language code, as configured in Polylang or WPML. |
What comes back
| Name | Type | What it is |
|---|---|---|
driver | string | Which plugin handled the call: Polylang or WPML. |
language | string | The language now assigned. |
success | boolean | Whether the call completed. |
message | string | A one-line summary of what happened, suitable for showing a human. |
error_code | string | Present only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation. |
Example
Ask your assistant:
Set post 88 to French.
It resolves to one call:
{
"ability": "content/set-post-language",
"parameters": {
"post_id": 88,
"language": "fr"
}
}Worth knowing
- The language code must exist in your Polylang or WPML settings.
- Setting the same language again changes nothing, so it is idempotent.
Related abilities
- Link Post Translations — connect it to its other versions
- Get Post Translations — check the result
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category