{"slug":"wpml-config","title":"wpml-config","summary":"Make a WordPress plugin/theme translatable with WPML by shipping a wpml-config.xml file. Covers the sections WPML honors — custom-fields/custom-field action=\"translate|copy|copy-once|ignore\" (post meta), custom-term-fields (term meta), custom-fields-texts (translatable sub-keys i","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-16T14:52:33.520903Z","repo":{"url":"https://github.com/Lonsdale201/wp-agent-skills","stars":26,"forks":2,"license":"MIT","updatedAt":"2026-11-15T13:11:43Z"},"bodyHtml":"<hr>\n<h2>name: wpml-config\ndescription: Make a WordPress plugin/theme translatable with WPML by shipping a wpml-config.xml file. Covers the sections WPML honors — custom-fields/custom-field action=\"translate|copy|copy-once|ignore\" (post meta), custom-term-fields (term meta), custom-fields-texts (translatable sub-keys inside serialized/JSON meta), custom-types /custom-type translate=\"0|1\" with display-as-translated and automatic attributes, taxonomies/taxonomy translate=\"0|1\", admin-texts /key name for options, shortcode-list (CSV) vs shortcodes (rich), built-with-page-builder, and gutenberg-blocks. Explains file discovery (plugin root, theme root, the wpml_config_array filter), the exact 0/1 boolean and action-enum values, that a typo'd action silently means \"ignore\", that the XSD is NOT enforced during normal parsing, and that admin-texts needs the String Translation add-on while gutenberg-blocks is handled by WPML's bundled page-builders add-on. Use when adding, auditing, or debugging a wpml-config.xml.\nmetadata:\nwp-skills-author: \"Soczó Kristóf\"\nwp-skills-contact: \"mailto:lonsdale201@hotmail.com\"\nwp-skills-plugin: \"sitepress-multilingual-cms\"\nwp-skills-plugin-version-tested: \"4.9.5\"\nwp-skills-php-min: \"7.4\"\nwp-skills-last-updated: \"2026-07-03\"</h2>\n<h1>WPML: the <code>wpml-config.xml</code> compatibility file</h1>\n<p><code>wpml-config.xml</code> is the <strong>declarative</strong> way to tell WPML what in your plugin/theme is translatable — custom fields, custom post types, taxonomies, options, and shortcodes. It needs zero runtime code: WPML reads it and configures itself. This is the first (and often only) compatibility step for most plugins. For runtime language logic see <code>wpml-language-api</code>; for dynamic strings see <code>wpml-string-translation</code>.</p>\n<h2>Where the file goes and when it's read</h2>\n<ul>\n<li><strong>Plugin:</strong> <code>wp-content/plugins/&lt;your-plugin&gt;/wpml-config.xml</code> (plugin root). Verified discovery at <a href=\"class-wpml-config.php\">class-wpml-config.php:152,169</a>.</li>\n<li><strong>Theme:</strong> child then parent theme root (<a href=\"class-wpml-config.php\">class-wpml-config.php:262,268</a>).</li>\n<li>WPML re-reads config files <strong>in admin only</strong>, on a whitelist of pages (<code>plugins.php</code>, <code>themes.php</code>, WPML's own pages, <code>string-translation.php</code> when ST is active), filterable via <code>wpml_config_white_list_pages</code> (<a href=\"class-wpml-config.php\">class-wpml-config.php:16-41</a>). So after editing the file, visit <code>Plugins</code> or a WPML settings page to make WPML re-parse it — it is not re-read on every front-end request.</li>\n</ul>\n<h2>Skeleton (illustrative — plugin-specific keys)</h2>\n<pre><code>&lt;wpml-config&gt;\n    &lt;custom-fields&gt;\n        &lt;custom-field action=\"translate\"&gt;subtitle&lt;/custom-field&gt;\n        &lt;custom-field action=\"copy\"&gt;_my_related_ids&lt;/custom-field&gt;\n        &lt;custom-field action=\"copy-once\"&gt;_my_layout&lt;/custom-field&gt;\n        &lt;custom-field action=\"ignore\"&gt;_my_cache&lt;/custom-field&gt;\n        &lt;custom-field action=\"translate\" encoding=\"json\"&gt;footnotes&lt;/custom-field&gt;\n    &lt;/custom-fields&gt;\n\n    &lt;custom-types&gt;\n        &lt;custom-type translate=\"1\"&gt;my_book&lt;/custom-type&gt;\n        &lt;custom-type translate=\"0\"&gt;my_log&lt;/custom-type&gt;\n    &lt;/custom-types&gt;\n\n    &lt;taxonomies&gt;\n        &lt;taxonomy translate=\"1\"&gt;my_genre&lt;/taxonomy&gt;\n        &lt;taxonomy translate=\"0\"&gt;my_internal_tax&lt;/taxonomy&gt;\n    &lt;/taxonomies&gt;\n\n    &lt;admin-texts&gt;\n        &lt;key name=\"my_plugin_options\"&gt;\n            &lt;key name=\"welcome_message\" /&gt;\n            &lt;key name=\"footer_note\" /&gt;\n        &lt;/key&gt;\n    &lt;/admin-texts&gt;\n\n    &lt;shortcode-list&gt;my_cta,my_button&lt;/shortcode-list&gt;\n&lt;/wpml-config&gt;\n</code></pre>\n<h2>The sections you'll actually use</h2>\n<h3><code>&lt;custom-fields&gt;</code> — post meta (base plugin)</h3>\n<p>Each <code>&lt;custom-field action=\"...\"&gt;meta_key&lt;/custom-field&gt;</code> sets how a meta key behaves across translations. The <strong>four <code>action</code> values</strong> are the enum honored by the parser (<a href=\"class-wpml-custom-field-xml-settings-import.php\">class-wpml-custom-field-xml-settings-import.php:78-96</a>):</p>\n<table>\n<thead>\n<tr>\n<th><code>action</code></th>\n<th>Behaviour</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>translate</code></td>\n<td>Field is offered for translation; each language has its own value.</td>\n</tr>\n<tr>\n<td><code>copy</code></td>\n<td>Value is copied from original to every translation and kept in sync.</td>\n</tr>\n<tr>\n<td><code>copy-once</code></td>\n<td>Copied when the translation is first created; editable independently after.</td>\n</tr>\n<tr>\n<td><code>ignore</code></td>\n<td>Not touched — translations keep whatever they have (default for anything).</td>\n</tr>\n</tbody>\n</table>\n<p>Add <code>encoding=\"json\"</code> for meta whose value is JSON (e.g. <code>footnotes</code> in WPML's own config, <a href=\"wpml-config.xml\">wpml-config.xml:24</a>). Term meta uses the identical <code>&lt;custom-term-fields&gt;/&lt;custom-term-field action=\"...\"&gt;</code> section.</p>\n<p><strong>Gotcha — a typo'd <code>action</code> silently becomes \"ignore\".</strong> The parser's <code>switch</code> has no validation branch; <code>translate</code>/<code>copy</code>/<code>copy-once</code> hit their cases and <strong>everything else falls to <code>default</code> → do nothing</strong> (<a href=\"class-wpml-custom-field-xml-settings-import.php\">:93-95</a>). <code>action=\"translated\"</code> or <code>action=\"Translate\"</code> therefore silently leaves the field untranslated. There is no error — see \"XSD not enforced\" below.</p>\n<h3><code>&lt;custom-fields-texts&gt;</code> — sub-keys inside a serialized/JSON meta</h3>\n<p>When a single meta key holds an array/JSON of many strings, declare exactly which inner keys are translatable with a nested <code>&lt;key name=\"...\"&gt;</code> tree (<code>name=\"*\"</code> = any key):</p>\n<pre><code>&lt;custom-fields-texts&gt;\n    &lt;key name=\"footnotes\"&gt;\n        &lt;key name=\"*\"&gt;&lt;key name=\"content\" label=\"Footnote\" /&gt;&lt;/key&gt;\n    &lt;/key&gt;\n&lt;/custom-fields-texts&gt;\n</code></pre>\n<p>Verified shape at <a href=\"wpml-config.xml\">wpml-config.xml:26-32</a>, parsed by <a href=\"class-wpml-custom-field-xml-settings-import.php\">class-wpml-custom-field-xml-settings-import.php:112-156</a>.</p>\n<h3><code>&lt;custom-types&gt;</code> / <code>&lt;taxonomies&gt;</code> — make CPTs &amp; taxonomies translatable</h3>\n<p><code>&lt;custom-type translate=\"1\"&gt;slug&lt;/custom-type&gt;</code> and <code>&lt;taxonomy translate=\"1\"&gt;slug&lt;/taxonomy&gt;</code>. <code>translate</code> is <strong>required</strong> and accepts <strong>only <code>0</code> or <code>1</code></strong> (the <code>wpml-integer-boolean</code> type — not <code>yes</code>/<code>no</code>/<code>true</code>). Read as <code>(int) $c['attr']['translate']</code> (<a href=\"class-wpml-tm-settings-update.php\">class-wpml-tm-settings-update.php:60</a>).</p>\n<p>Two optional attributes on both:</p>\n<ul>\n<li><code>display-as-translated=\"1\"</code> — with <code>translate=\"1\"</code>, upgrades the mode to \"display as translated\" (fall back to the original language when no translation exists). It's rewritten to the internal mode 2 before processing (<a href=\"class-wpml-config-display-as-translated.php\">class-wpml-config-display-as-translated.php:21-40</a>). It is an <strong>attribute</strong>, not a <code>&lt;display-as-translated&gt;</code> section.</li>\n<li><code>automatic=\"1|0\"</code> — flags the type for automatic translation (<a href=\"Automatic.php\">vendor/wpml/core-api/core/settings/Automatic.php:19-30</a>).</li>\n</ul>\n<h3><code>&lt;admin-texts&gt;</code> — plugin options (needs String Translation)</h3>\n<p>Declares option names (and nested keys for serialized/array options) as translatable:</p>\n<pre><code>&lt;admin-texts&gt;\n    &lt;key name=\"my_plugin_options\"&gt;\n        &lt;key name=\"welcome_message\" /&gt;\n    &lt;/key&gt;\n    &lt;key type=\"post-ids\" sub-type=\"attachment\" name=\"my_logo_id\" /&gt;\n&lt;/admin-texts&gt;\n</code></pre>\n<p><code>name</code> is the <code>wp_options</code> name; nested <code>&lt;key&gt;</code> are keys inside a serialized/array option. <code>type=\"post-ids\" sub-type=\"attachment\"</code> marks a value as an object ID to convert to the translation rather than a string to translate.</p>\n<p><strong>Source-verified caveat:</strong> the base plugin <strong>declares</strong> <code>admin-texts</code> in its XSD but does <strong>not consume</strong> it — option translation is registered by <strong>WPML String Translation</strong> (which hooks <code>wpml_config_array</code>). On a base-only install this section does nothing. Confirmed: <code>class-wpml-config.php</code> initialises <code>'admin-texts' =&gt; array()</code> but <code>merge_with()</code> never dispatches it, and no consumer exists in the base plugin. Gate any expectation on <code>defined('WPML_ST_VERSION')</code>.</p>\n<h3>Shortcodes — two mechanisms</h3>\n<ul>\n<li><strong><code>&lt;shortcode-list&gt;tag1,tag2&lt;/shortcode-list&gt;</code></strong> (base) — a comma-separated list of shortcode tags whose <strong>content</strong> WPML registers for translation. Exploded on commas at <a href=\"class-wpml-config.php\">class-wpml-config.php:432-434</a>, stored via <code>WPML_Config_Shortcode_List</code>.</li>\n<li><strong><code>&lt;shortcodes&gt;&lt;shortcode&gt;&lt;tag&gt;…&lt;/tag&gt;&lt;attributes&gt;&lt;attribute&gt;…&lt;/attribute&gt;&lt;/attributes&gt;&lt;/shortcode&gt;&lt;/shortcodes&gt;</code></strong> (rich) — per-tag control over content and translatable attributes; consumed by the bundled <strong>page-builders</strong> add-on, not core. Use <code>&lt;shortcode-list&gt;</code> for the simple \"translate this shortcode's inner text\" case.</li>\n</ul>\n<p><code>&lt;built-with-page-builder&gt;&lt;![CDATA[/&lt;!-- wp:/]]&gt;&lt;/built-with-page-builder&gt;</code> marks builder-generated content via a regex; <code>&lt;gutenberg-blocks&gt;</code> declares per-block translatable parts — its config is parsed by WPML's <strong>bundled page-builders add-on</strong> (loaded unconditionally at <a href=\"sitepress.php\">sitepress.php:512</a>, so it works on a base install), though translating the block <em>content</em> additionally needs String Translation. Full section reference in <code>reference.md</code>.</p>\n<h2>Programmatic config — the <code>wpml_config_array</code> filter</h2>\n<p>To add/modify config without a file (or for dynamically-registered post types), hook the main extension point (<a href=\"class-wpml-config.php\">class-wpml-config.php:345</a>):</p>\n<pre><code>add_filter( 'wpml_config_array', function ( $config ) {\n    $config['wpml-config']['custom-types']['custom-type'][] = [\n        'value' =&gt; 'my_dynamic_cpt',\n        'attr'  =&gt; [ 'translate' =&gt; 1 ],\n    ];\n    return $config;\n} );\n</code></pre>\n<p>Every parsed element has the <code>[ 'value' =&gt; ..., 'attr' =&gt; [...] ]</code> shape; a single entry is that array, multiple entries are a list of them.</p>\n<h2>Critical rules</h2>\n<ul>\n<li><strong><code>translate</code> / <code>display-as-translated</code> / <code>automatic</code> are <code>0</code> or <code>1</code></strong> — never <code>yes</code>/<code>no</code>/<code>true</code>/<code>false</code>.</li>\n<li><strong><code>action</code> is exactly <code>translate</code> / <code>copy</code> / <code>copy-once</code> / <code>ignore</code>.</strong> Anything else silently means \"ignore\" (no error).</li>\n<li><strong>The XSD is NOT enforced during normal file parsing</strong> (<a href=\"class-wpml-config.php\">class-wpml-config.php:324</a> — validated with no XSD). Malformed elements, typo'd attributes, and wrong nesting are silently skipped, not reported. Validate your file against <code>res/xsd/wpml-config.xsd</code> yourself before shipping.</li>\n<li><strong><code>admin-texts</code> requires String Translation</strong> — declaring options does nothing without ST active. <strong><code>gutenberg-blocks</code> is handled by WPML's bundled page-builders add-on</strong> (parsed on a base install); only translating the block <em>content</em> additionally needs ST.</li>\n<li><strong>Re-parse is admin-and-whitelisted-page only</strong> — edit the file, then load <code>Plugins</code>/<code>Themes</code>/a WPML settings page to apply it; don't expect front-end reloads.</li>\n<li><strong>Place the file in the plugin/theme ROOT.</strong> Subfolders are not scanned.</li>\n<li><strong>Ship the file; don't rely on WPML.org's remote config</strong> for your own plugin — remote config is a fallback for plugins that don't ship one.</li>\n</ul>\n<h2>Common mistakes</h2>\n<pre><code>&lt;!-- WRONG — boolean/action values WPML doesn't recognise (silently ignored) --&gt;\n&lt;custom-type translate=\"yes\"&gt;my_book&lt;/custom-type&gt;\n&lt;custom-field action=\"translated\"&gt;subtitle&lt;/custom-field&gt;\n\n&lt;!-- RIGHT --&gt;\n&lt;custom-type translate=\"1\"&gt;my_book&lt;/custom-type&gt;\n&lt;custom-field action=\"translate\"&gt;subtitle&lt;/custom-field&gt;\n</code></pre>\n<pre><code>&lt;!-- WRONG — expecting &lt;admin-texts&gt; to translate options on base WPML --&gt;\n&lt;admin-texts&gt;&lt;key name=\"my_option\"/&gt;&lt;/admin-texts&gt;\n&lt;!-- ...with no String Translation active → nothing happens. Gate on WPML_ST_VERSION. --&gt;\n</code></pre>\n<h2>Cross-references</h2>\n<ul>\n<li><strong><code>wpml-string-translation</code></strong> — for options/dynamic strings when <code>admin-texts</code> isn't enough, and the ST dependency.</li>\n<li><strong><code>wpml-language-api</code></strong> — runtime behaviour once your content is translatable.</li>\n<li><strong><code>wpml-overview</code></strong> — the base-vs-add-on split and decision matrix.</li>\n<li>See <code>reference.md</code> for the complete honored-section table + the sections WPML does NOT support.</li>\n</ul>\n<h2>What this skill does NOT cover</h2>\n<ul>\n<li><strong><code>&lt;gutenberg-blocks&gt;</code> / page-builder widget sections in depth</strong> — declared in base XSD but consumed by ST / the page-builders add-on; see <code>reference.md</code> for the shape.</li>\n<li><strong>Options/string translation runtime</strong> — <code>wpml-string-translation</code>.</li>\n<li><strong>Sections WPML does NOT honor</strong> (<code>gettext-domains</code>, <code>custom-css</code>, <code>pages</code>, <code>post-types</code>, <code>custom-c2c-relationships</code>) — listed in <code>reference.md</code> so you don't invent them.</li>\n</ul>\n<h2>References</h2>\n<ul>\n<li>Real-world example: <a href=\"wpml-config.xml\">wpml-config.xml</a> (WPML's own).</li>\n<li>Schema: <a href=\"wpml-config.xsd\">res/xsd/wpml-config.xsd</a> (462 lines — every element/attribute).</li>\n<li>Loader/discovery + filters: <a href=\"class-wpml-config.php\">classes/xml-config/class-wpml-config.php</a> — discovery (142-274), <code>wpml_config_array</code> (345), XSD-not-enforced (324), section merge (403-444).</li>\n<li>Custom-field <code>action</code> parser: <a href=\"class-wpml-custom-field-xml-settings-import.php\">classes/settings/class-wpml-custom-field-xml-settings-import.php:78-96</a>.</li>\n<li>CPT/taxonomy <code>translate</code> parser: <a href=\"class-wpml-tm-settings-update.php\">classes/settings/class-wpml-tm-settings-update.php:60</a>.</li>\n<li>Official documentation: <a href=\"https://wpml.org/documentation/support/language-configuration-files/\">https://wpml.org/documentation/support/language-configuration-files/</a></li>\n</ul>\n","files":[{"path":"reference.md","sizeBytes":6068,"isText":true},{"path":"SKILL.md","sizeBytes":12595,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-16T14:59:50.989404Z","sha256":"7D7D32B3D46A9CC94006DCB24BBDFB3FBD9987A5A20E0E6A30D25157148CC1FC","sizeBytes":7447},"review":null,"source":{"repositoryUrl":"https://github.com/Lonsdale201/wp-agent-skills","path":"wpml/wpml-config","license":"MIT","commit":"9025fda280d15da3e2ba376a66940e75bd45f3ce","subtreeSha":"4659B7B5E30DA90D469B4C15CDF4443088B6A72D09ABA73AEFA4FCC2DCA1228A","lastSyncedAt":"2026-11-17T00:39:45.243627Z"},"reviewedAt":"2026-09-16T15:22:28.3999Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/Lonsdale201/wp-agent-skills/tree/main/wpml/wpml-config"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install lonsdale201-wp-agent-skills@llmmart"},{"target":"git","command":"git clone https://github.com/Lonsdale201/wp-agent-skills.git"}]}