Set Polylang Post Language
Sets which language a post or page is in, for example one written before Polylang was installed, or one marked with the wrong language. Its translation links are kept, so it becomes that group's version in the new language; if the group already has a post in that language it refuses and names it, unless leave_translation_group is true, which takes this post out of its group first. Reversible by setting the old language again. Categories and tags already assigned are not switched to the new language; the result lists any that are in another language.
Also known as: change post language, mark this page as French, assign a language.
| Property | Value |
|---|---|
| Ability slug | mosmcp/polylang-set-post-language |
| Wire tool name | mosmcp__polylang-set-post-language |
| Category | Polylang (mosmcp-polylang) |
| Plan | Pro |
Required access
| Requirement | Value |
|---|---|
| Capability | edit_posts |
| Minimum default role | Contributor |
| Annotations | readOnly: false · destructive: false · idempotent: true · openWorld: false |
Input schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| post_id | integer (min 1) | Yes | — | The post or page whose language to set. |
| language | string (min length 1) | Yes | — | The language it is written in: its code from mosmcp/polylang-list-languages, such as "fr", or its locale, such as "fr_FR". |
| leave_translation_group | boolean | false |
Take the post out of its translation group before changing its language, so it stands alone. Default false. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| post_id | integer | Yes | |
| title | string | ||
| previous_language | string | Yes | The language before, or empty when it had none. |
| current_language | string | Yes | The language now stored, read back from Polylang. |
| changed | boolean | Yes | |
| left_translation_group | boolean | ||
| translations | object | Its translation group now: language code => post ID. | |
| terms_in_other_language | object[] | Categories and tags on the post that are in a different language from it. | |
| terms_in_other_language[].taxonomy | string | Yes | |
| terms_in_other_language[].term_id | integer | Yes | |
| terms_in_other_language[].name | string | Yes | |
| terms_in_other_language[].language | string | The term's language, or empty when it has none. | |
| terms_in_other_language[].translation_id | integer | Yes | Its version in the post's language, or 0 when there is none yet. |
| notes | string[] |
| << Previous | Next >> |
|---|---|
| List Polylang Languages | Update Polylang String Translation |
For more information about the Secure MCP Server for WordPress plugin, explore the following resources:
Product Overview | Pricing | Try for Free | Documentation
If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.