Hello,
Thanks for contacting us and sorry for any inconvenience that might have been caused due to that.
To translate the Produkter in the crumbs, please use the filter given below:
add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
$crumbs[1][0] = pll__("Produkter");
return $crumbs;
}, 10, 2);
Hope this helps. Let us know if you need any other assistance.
Hi
That dont work.
Beacuse the filter code will not translate “Home url” and “Archive url”
It only translate the second in the breadcrumbs.
Meaning that the breadcrumb will look like this:
Hem / Etusivu for finland.
Hem / Hem for sweden.
Hem / Home for english
When it should be
Hem/ Produkter/ Produktensnamn
English
Home/Products/Productname.
Products = CTP – archive.
So we have the problem to translate all our Custom post type – archive titles in breadcrumbs.
We did try this code below, for translate the archive title.
add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
$home_link = pll_home_url(pll_current_language());
$crumbs[0][0] = pll__("Hem");
$crumbs[0][1] = $home_link;
if ( is_archive() && isset( $crumbs[1] ) ) {
$crumbs[1][0] = pll__(post_type_archive_title('', false));
}
return $crumbs;
}, 10, 2);
But, when you then visit taxonomy page. The breadcumb will only be
Home/
Missing the the taxonomy name.
When you go to single-page. The breadcrumbs look like:
Home/Produkter/Taxonomy-name/Product-name
Meaning that the archive “Produkter” are not translated here.
So we figure out that we need to add something more in the filter.
For both single-pages and taxonomy.
And got stuck there.
And should you need to do all this filter code for making the breadcumbs to work?
Hello,
The breadcrumbs work fine with other translation plugins that are compatible with Rank Math like WPML, TranslatePress, and Weglot. PolyLang is still not compatible with our plugin and that’s why you have to fix the breadcrumbs using the filter.
However, further customization of the filter falls out of the scope of our support. You will have to modify it by yourself according to the setup of your post types.
Let us know if you need any other assistance.
Thanks.
Hi
Okey, do you have any plans for making RankMath compatible with Polylang?
Hello,
We have been trying to collaborate with Polylang for a few years but left the conversation when they refused to add the compatibility even though they have it for several other plugins (some of them have a smaller user-base compared to RM)
https://github.com/polylang/polylang/tree/master/integrations
You can check their public repository where we created a pull request a few years back and we would have maintained it (though that would not have happened ideally since we do not make changes in the plugin that breaks the compatibility).
Disappointingly, the compatibility needs to be added in their plugin as they added for other SEO plugins. We are more than committed to making that happen and always keep it updated, of course, if their team agreed and wanted to collaborate.
With that said, you can check the following page for alternatives that are 100% compatible with the Rank Math SEO plugin
https://rankmath.com/compatibility/
https://rankmath.com/compatibility/?s=Translate&post_type=rm_compatible
Hope this helps.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.