Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Pcosta88 opened this issue Jun 23, 2017 · 13 comments

Comments

@Pcosta88
Copy link
Contributor

Pcosta88 commented Jun 23, 2017

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
Copy link
Contributor Author

related: #979

@Pcosta88
Copy link
Contributor Author

@Pcosta88
Copy link
Contributor Author

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

@Pcosta88
Copy link
Contributor Author

Pcosta88 commented Apr 9, 2019

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

@soulstyle
Copy link

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.

@Djennez
Copy link
Member

Djennez commented Apr 10, 2019

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.

@Pcosta88
Copy link
Contributor Author

Pcosta88 commented Jun 7, 2019

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

@Pcosta88
Copy link
Contributor Author

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

@webprom
Copy link

webprom commented Jun 7, 2020

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?

@mmikhan
Copy link
Member

mmikhan commented Oct 4, 2020

@IgorSan1986
Copy link

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

@ehnsio
Copy link

ehnsio commented Mar 26, 2024

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests