Set Post Language


Sets which language a post or page is in, for example one written before WPML was installed, or one marked with the wrong language. A post linked to translations is refused unless leave_translation_group is true, which first takes it out of its group so it stands alone in the new language (its former translations stay linked to each other; nothing is deleted). Reversible by setting the old language again, though leaving a group is not undone by that. Categories and tags already assigned are not switched. Get language codes from mosmcp/wpml-list-languages.

Also known as: change post language, mark this page as French, assign a language.

Property Value
Ability slug mosmcp/wpml-set-post-language
Wire tool name mosmcp__wpml-set-post-language
Category WPML (mosmcp-wpml)
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/wpml-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 so it stands alone in the new language. Needed when it is linked to translations. 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 WPML.
changed boolean Yes
left_translation_group boolean
translations object Its translation group now: language code => post ID.
notes string[]

 


<< Previous Next >>
List WPML Languages Update WPML 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.