Remove rel=canonical tag

#45753
  • Resolved Lyon Béton
    Rank Math free

    Hello, my site has a French and English version. (the English version being the principal version of the site and the French one the translation with WPML).

    My texts are enriched in SEO to be referenced by google in both languages.

    I would like to remove the rel=canonical tags so that I can reference the French part and not only the English part.

    The Hreflang tags are already indicated to make sure that google understands that this is only the translation of the site and that it does not classify it as a duplicate content.

    Is this possible?

    • This topic was modified 4 years, 10 months ago by Lyon Béton.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The Hreflang tags are already indicated to make sure that google understands that this is only the translation of the site and that it does not classify it as a duplicate content.

    Hello,

    Thank you for contacting Rank Math today.

    You can use the following filter to disable the canonical tag. Configuring it to return false will disable the tag:

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

    Looking forward to helping you. Thank you.

    ​​​​​​

    Thanks for responding so quickly, where should I write this code?

    Alberto
    Rank Math business

    Hello,

    At the end of the functions.php file inside your current active theme.

    Thank you.

    Thanks a lot, guys.

    Hello,

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

    If you don’t mind me 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 do 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 6 replies - 1 through 6 (of 6 total)

The ticket ‘Remove rel=canonical tag’ is closed to new replies.