Hello,
Thank you for contacting Rank Math for help with setting meta descriptions for your pages translated with Polylang, and sorry for the inconvenience this has caused you.
Rank Math is currently not fully compatible with Polylang so tanslated meta descriptions might not be automatically generated, depending on your set up.
Please add the following code snippet to your website to translate meta descriptions:
add_filter( 'rank_math/frontend/description', function( $description ) {
foreach (pll_languages_list( ['fields' =>'locale'] ) as $current_locale){
if (get_locale() == $current_locale ) {
$opt_titles = get_option('rank-math-options-titles'); //tax_post_tag_description is an item inside the rank-math-options-titles database field.
$description = \RankMath\Helper::replace_vars(pll_translate_string( $opt_titles['tax_post_tag_description'], get_locale() ));
return $description;
}
}
});
You can follow this guide for how to add the code to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps. Please let us know if you have questions.
This is not working, The description was removed instead.
Hello,
Sorry to disappoint, but we would need Polylang’s support to make the plugin compatible with theirs.
We opened a PR with them quite some time back but they are not responding to it:
https://github.com/polylang/polylang/pull/373
Once they make their plugin compatible with Rank Math, such issues could be tackled effectively.
For now, we can closing this ticket because you would need to reach out to their support to add the compatibility.
Or, you can use any of the other compatible translation plugins:
https://rankmath.com/compatibility/
If there is anything else we can help you with, please feel free to open a new support ticket.