Canonical URL Conflict with Polylang

#478920
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math support, and sorry for any inconvenience that might have been caused due to that.

    Checking the affected website, we can also confirm that it is happening on the desktop version.

    Unfortunately, Polylang is not yet fully compatible with Rank Math. The reason you are having the issue is that translated URL canonical is not similar to the translated page URL. You can check this list for compatible products with Rank Math:
    https://rankmath.com/compatibility/

    To set the correct canonical URL, please use the following filter to set the self-referencing canonical URL:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    	$canonical = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	return $canonical;
    });

    Here is how to add a filter to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope this helps. Let us know if you need any other assistance.

    Hello Jermy, I have added the snippet to our child theme, and all is working well now.
    Thanks for your help!

    Hello,

    We are super happy that this issue is already resolved. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Canonical URL Conflict with Polylang’ is closed to new replies.