This thread is resolved. Here is a description of the problem and solution.
Problem:
You are experiencing issues with translating Yoast SEO Meta Data on user pages, such as author pages.
Solution:
If you're facing this issue, we recommend you try the following steps:
1. Open your theme's
functions.php
file.
2. Add the following code to implement a workaround for translating author titles and descriptions with WPML:
// WPML Workaround for compsupp-7364<br />add_filter('wpseo_title','wpml_compsupp7364_translate_author_title', 10, 2 );<br />add_filter('wpseo_opengraph_title','wpml_compsupp7364_translate_author_title', 10, 2 );<br />add_filter('wpseo_metadesc','wpml_compsupp7364_translate_author_description', 10, 2 );<br />add_filter('wpseo_opengraph_desc','wpml_compsupp7364_translate_author_description', 10, 2 );<br /><br />function wpml_compsupp7364_translate_author_title($title, $presentation) {<br /> if ( class_exists('Sitepress') && is_author() ) {<br /><br /> $string = $title;<br /> $textdomain = 'Authors';<br /> $string_name = 'wpseo_title_'.$presentation->source['post_author'];<br /><br /> // Apply the translation to the string<br /> $title = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);<br /> }<br /><br /> return $title;<br />}<br /><br />function wpml_compsupp7364_translate_author_description($title, $presentation) {<br /> if ( class_exists('Sitepress') && is_author() ) {<br /><br /> $string = $title;<br /> $textdomain = 'Authors';<br /> $string_name = 'wpseo_metadesc_'.$presentation->source['post_author'];<br /><br /> // Apply the translation to the string<br /> $title = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);<br /> }<br /><br /> return $title;<br />}
3. Save the changes and ensure the code is correctly added without syntax errors.
Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 8 replies, has 2 voices.
Last updated by 1 year, 1 month ago.
Assisted by: Bruno Kos.