Overriding the Canonical URL

#210736
Viewing 3 replies - 1 through 3 (of 3 total)
  • Ankit
    Rank Math business

    Hello,

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

    by default the canonical will set for your post/pages. If you wish to modify the canonical dynamically.

    You can use the following filter and modify it according to your need.

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

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Perfect,

    Thank you Ankit. I will work with our team to deploy this change

    Ankit
    Rank Math business

    Hello,

    Glad that helped.

    Please feel free to reach out to us again in case you need any other assistance.

    We are here to help.

    Thank you.

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

You must be logged in to reply to this ticket.