Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by Bruno Kos 6 days, 5 hours ago.

Assisted by: Bruno Kos.

Author Posts
May 7, 2024 at 11:33 am

marcJ-16

So the issue I'm having is translating Yoast SEO Meta Data on User Pages. I have a user page, e.g. /author/josep-garcia/, that displays the relevant meta data:

May 7, 2024 at 12:10 pm
May 7, 2024 at 1:02 pm #15602134

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I tested this here:
hidden link

On:
hidden link

i see:

<meta name="description" content="Meta description to use for Author page EN" class="yoast-seo-meta-tag" />
	<meta property="og:locale" content="de_DE" class="yoast-seo-meta-tag" />
	<meta property="og:type" content="profile" class="yoast-seo-meta-tag" />
	<meta property="og:title" content="demo" class="yoast-seo-meta-tag" />
	<meta property="og:description" content="Meta description to use for Author page EN" class="yoast-seo-meta-tag" />

Even though is it translated on hidden link

Can you confirm this is the issue? If so I will escalate this to our developers.

May 7, 2024 at 1:27 pm #15602283

marcJ-16

Hi, thanks for recreating the issue. Yes this the same issue - I would expect to see "Meta description to use for Author page German" on /de/author/demo/ in the meta description field but I can just see the EN version.

May 8, 2024 at 6:42 am #15604393

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

This has been escalated to our Compatibility team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you.

May 13, 2024 at 2:41 pm #15621498

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Can you please try the following:

1. Open your theme `functions.php` file
2. Add this code to the file to implement a workaround for translating author titles and descriptions with WPML:

// WPML Workaround for compsupp-7364
add_filter('wpseo_title','wpml_compsupp7364_translate_author_title', 10, 2 );
add_filter('wpseo_opengraph_title','wpml_compsupp7364_translate_author_title', 10, 2 );
add_filter('wpseo_metadesc','wpml_compsupp7364_translate_author_description', 10, 2 );
add_filter('wpseo_opengraph_desc','wpml_compsupp7364_translate_author_description', 10, 2 );


function wpml_compsupp7364_translate_author_title($title, $presentation) {
	if ( class_exists('Sitepress') && is_author() ) {

		$string = $title;
		$textdomain = 'Authors';
		$string_name = 'wpseo_title_'.$presentation->source['post_author'];

		// Apply the translation to the string
		$title = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);
	}

	return $title;
}

function wpml_compsupp7364_translate_author_description($title, $presentation) {
	if ( class_exists('Sitepress') && is_author() ) {

		$string = $title;
		$textdomain = 'Authors';
		$string_name = 'wpseo_metadesc_'.$presentation->source['post_author'];

		// Apply the translation to the string
		$title = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);
	}

	return $title;
}

3. Save the changes and ensure the code is correctly added without syntax errors.

Let me know if this works.

May 16, 2024 at 8:22 am #15633646

marcJ-16

Hi, I tried this but it's still showing the Spanish translated text on both EN and ES pages.

May 16, 2024 at 10:06 am #15634281

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

This code seems to be working on hidden link.

In your case did you clear the site and server cache? Also, can you try this?
hidden link

So run the "Reset indexables tables & migrations" option and check then.

If not working, can you provide me with WordPress credentials again? Because it seems that those I used before no longer work.

May 23, 2024 at 8:30 am #15661340

marcJ-16

I reset the Yoast indexes as suggested as I think it might be working now. I've asked the client to test too. I will feedback soon. Thanks!

May 23, 2024 at 9:46 am #15661910

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Ok, let us know.