wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

[Feature Request] Make Yoast SEO Breadcrumbs Translatable with Polylang and WPML

Open Pcosta88 opened this issue 8 years ago • 13 comments

The Yoast SEO Premium Breadcrumbs are not translatable.

1.Add Yoast SEO Premium Breadcrumbs

screen shot 2017-06-23 at 10 33 09 am

2.With PolyLang Create a post in Spanish

screen shot 2017-06-23 at 10 28 21 am

3.See on frontend that breadcrumbs such as Home not translated

1

4.With WPML create a post in Dutch

screen shot 2017-06-23 at 10 43 23 am

4.See on FrontEnd that Breadcrumbs such as Home not translated screen_shot_2017-06-23_at_10_40_39_am

We should make them translatable.

NOTE: 1. The categories that appear in the breadcrumb pathway can be configured in the SEO-Advanced-Breadcrumb section.

screen shot 2017-06-23 at 10 44 40 am

2. To make the categories appear as "translated" you would need to create the categories in that language on the backend.

3.However, "home" should be translated.

Specs WordPress: 4.8 Yoast: 4.8 Polylang 2.1.5 WPML: 3.5.3.1

Pcosta88 avatar Jun 23 '17 14:06 Pcosta88

related: https://github.com/Yoast/wordpress-seo/issues/979

Pcosta88 avatar Jun 23 '17 14:06 Pcosta88

related: https://wpml.org/forums/topic/wp-seo-yoast-breadcrumbs-problem-with-wpml

Pcosta88 avatar Jun 23 '17 14:06 Pcosta88

Please inform the customer of conversation # 204026 when this conversation has been closed.

Pcosta88 avatar Jun 23 '17 14:06 Pcosta88

Please inform the customer of conversation # 492734 when this conversation has been closed.

Pcosta88 avatar Apr 09 '19 17:04 Pcosta88

Is there any updates on this, the referenced WPML support thread was started 5 years ago!

We are having this problem on multiple client sites and is, therefore, getting bug reports about this at least every second month.

soulstyle avatar Apr 10 '19 08:04 soulstyle

This does not have our immediate attention or priority to implement. We do welcome any attempt to add this as a functionality through a PR.

Djennez avatar Apr 10 '19 13:04 Djennez

Please inform the customer of conversation # 513594 when this conversation has been closed.

Pcosta88 avatar Jun 07 '19 14:06 Pcosta88

Please inform the customer of conversation # 581186 when this conversation has been closed.

Pcosta88 avatar Jan 30 '20 19:01 Pcosta88

after updating to yoast 14.2 i have different languages breadcrumbs with wrong translations, it was ok before the update. tried with multilanguage yoast plugin and without it. using suggested xml:

<wpml-config>
    <admin-texts>
        <key name="wpseo_titles">
            <key name="breadcrumbs-404crumb"/>
            <key name="breadcrumbs-archiveprefix"/>
            <key name="breadcrumbs-home"/>
            <key name="breadcrumbs-prefix"/>
            <key name="breadcrumbs-searchprefix"/>
            <key name="breadcrumbs-sep"/></key>
    </admin-texts>
</wpml-config>

Any ideas? Can it be fixed?

webprom avatar Jun 07 '20 18:06 webprom

+1 https://wordpress.org/support/topic/breadcrumb-home-link-not-working-right/

mmikhan avatar Oct 04 '20 10:10 mmikhan

+1 https://wordpress.org/support/topic/yoast-and-polylang-how-to-translate-breadcrumbs-title/

maybellyne avatar Oct 20 '22 12:10 maybellyne

Same problem, breadcrumbs from custom post-type do not translate

IgorSan1986 avatar Oct 20 '23 19:10 IgorSan1986

Using polylang and having the same issue, would be a nice feature. I did a workaround to fetch the page title and url of the translated page in the correct current language.

function replace_lang_breadcrumbs($crumbs)
{
	// Get the last breadcrumb
	$last_crumb = end($crumbs);

	// Extract language code from the last breadcrumb URL
	preg_match('/\/([a-zA-Z\-_]+)\//', $last_crumb['url'], $matches);
	$current_language = isset($matches[1]) ? $matches[1] : '';

	foreach ($crumbs as $index => $crumb) {
		// Check if the breadcrumb corresponds to the current language
		if (!pll_is_translated_post_type($crumb['id'])) {
			// Get the translation of the page using the ID
			$translated_post_id = pll_get_post($crumb['id'], $current_language);
			if ($translated_post_id) {
				// Get the translated post title and permalink
				$translated_post_title = get_the_title($translated_post_id);
				$translated_post_permalink = get_permalink($translated_post_id);

				// Replace the breadcrumb with the translated post title and permalink
				$crumbs[$index]['url'] = $translated_post_permalink;
				$crumbs[$index]['text'] = $translated_post_title;
			}
		}
	}
	return $crumbs;
}

add_filter('wpseo_breadcrumb_links', 'replace_lang_breadcrumbs', 10, 1);

ehnsio avatar Mar 26 '24 11:03 ehnsio