Hello @tunyk ,
Thank you for contacting Rank Math support.
We have updated the guide with the new code that includes the fix for the issue you’re facing. https://rankmath.com/kb/polylang-compatibility/
Please use the new code on your site.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Thread Starter
tunyk
(@tunyk)
Hello @jaideeprm ,
I don’t see any changes in the code on the page https://rankmath.com/kb/polylang-compatibility/ . It is identical to what was there on February 3rd.
Hello @tunyk ,
We have updated the function from:
public function rm_home_canonical( $canonical ) {
global $post;
$post_id = (int) get_option( 'page_on_front' );
if ( ! is_home() && $post->ID !== pll_get_post( $post_id ) ) {
return $canonical;
}
$path = ltrim( (string) wp_parse_url( pll_get_requested_url(), PHP_URL_PATH ), '/' );
return $canonical . $path;
}
To:
public function rm_home_canonical( $canonical ) {
global $post;
$post_id = (int) get_option( 'page_on_front' );
if ( ! is_home() && ! empty( $post->ID ) && $post->ID !== pll_get_post( $post_id ) ) {
return $canonical;
}
$path = ltrim( (string) wp_parse_url( pll_get_requested_url(), PHP_URL_PATH ), '/' );
return $canonical . $path;
}
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Thread Starter
tunyk
(@tunyk)
This fragment is currently unchanged on your site. I cleared my cache several times, but no changes. It is possible that caching is on your side.
So I’m using the code from your comment here
This reply was modified 3 months, 3 weeks ago by tunyk .
Hello @tunyk ,
Sorry for the inconvenience caused. We have cleared the site’s cache and the new code should now be available in the guide.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Thread Starter
tunyk
(@tunyk)
Yes, the code on your site is now updated. Thank you!
Hello @tunyk ,
We are glad that the issue has been resolved.
Please do not hesitate to let us know if you need our assistance with anything else.
Thank you.