Canonical links for URLs created by weglot

#314421
  • Resolved Pinguinweb
    Rank Math free

    Hi,

    we have a website which is translated by weglot. We just found out that the URLs in multiple languages still have the same canonical link of each page in the original language. How can we fix that?

Viewing 1 replies (of 1 total)
  • Hello,

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

    To change the canonical URLs to point towards the actual page of the language, please modify and use the following filter in your theme’s functions.php file:

    /**
     * Allow changing of the canonical URL.
     *
     * @param string $canonical The canonical URL.
     */
    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    	return $canonical;
    });

    Here is an article that will come in handy to know where to use the filters on your website:
    https://rankmath.com/kb/filters-hooks-api-developer/

    Here is an article that might come in handy, to know more about optimizing your website using weglot with Rank Math:

    https://rankmath.com/kb/wordpress-multilingual-seo-with-rankmath-weglot/

    Please let us know how that goes. Looking forward to helping you further.

    Thank you

    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.

Viewing 1 replies (of 1 total)

The ticket ‘Canonical links for URLs created by weglot’ is closed to new replies.