Open
Overview of the issue
When using Rank Math SEO with WPML, the content of the Rank Math rich snippet shortcode [rank_math_rich_snippet id="..."]
will not be translated.
Workaround
Step 1: Make the fields translatable
- Go to „WPML > Settings > Custom XML Configuration“.
- Add the following and click „Save“.
<wpml-config> <custom-fields> <custom-field action="translate">rank_math_schema_HowTo</custom-field> <custom-field action="translate">rank_math_schema_Article</custom-field> <custom-field action="translate">rank_math_schema_SoftwareApplication</custom-field> </custom-fields> <custom-fields-texts> <key name="rank_math_schema_HowTo"> <key name="name" /> <key name="description" /> </key> <key name="rank_math_schema_SoftwareApplication"> <key name="headline" /> <key name="description" /> <key name="review"> <key name="negativeNotes"> <key name="itemListElement"> <key name="*"> <key name="name" /> </key> </key> </key> <key name="positiveNotes"> <key name="itemListElement"> <key name="*"> <key name="name" /> </key> </key> </key> </key> </key> <key name="rank_math_schema_Article"> <key name="headline" /> <key name="description" /> </key> </custom-fields-texts> </wpml-config>
- Do a small modification to the original page and save.
- Translate the page.
Step 2: Adjust the shortcode or use the Rank Math block
- The shortcode
[rank_math_rich_snippet id="..."]
includes a unique ID. - Use
[rank_math_rich_snippet]
shortcode instead (without the id attribute). - Alternatively, use the Schema by RankMath block.