Double canonical tag on one page

#455212
  • Resolved Bonheur en vrac
    Rank Math pro

    Hello,

    We have a double canonical tag issue on our website registration page.

    Since our goal is to only keep one canonical tag on this page, I tried disabling the canonical tag from Rankmath by adding this code in the child theme’s functions.php file :

    if ( is_page( 6777 ) ) {
    add_filter( ‘wpseo_canonical’, ‘__return_false’ );
    remove_action(‘wp_head’, ‘rel_canonical’);
    }

    However, it didn’t work. Can you advise on how to remove the canonical tag from RankMath on only one page in particular?

    Thank you,

    Francis

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

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

    Please try this filter code instead:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
      if ( is_page( 6777 ) ) {
        $canonical = false;
      }
    	return $canonical;
    });

    Let us know how that goes. Looking forward to helping you.

    Hello Jeremy,

    Thank you for your quick reply.

    Unfortunately, the snippet provided did not work. I added it to our child theme’s function.php file, but we still have two identical canonical tags when inspecting the Inscription page.

    Is there anything else we could try in order to remove the canonical tag from RankMath on this page?

    Thank you,

    Francis

    Hello,

    I tested the code on my end and it seems to be working just fine.

    Can you please try clearing your website cache and check again?

    If the issue persists, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    I just verified and I now have one canonical tag as expected. The cache was probably the issue here.

    Thank you!

    Hello,

    Thank you for the update.

    We are glad that this issue is already resolved.

    If you have any other concerns, please don’t hesitate to contact us anytime to assist you further.

    Looking forward to helping you.

    Thank you.

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

You must be logged in to reply to this ticket.