canonical

#291417
  • Resolved Bgm Squad
    Rank Math free

    Hey there my client used no canonical tags to whole site via functions.php. he found that trick from support here.

    Now he updated his theme and lost that script in functions.php.

    Now all the links in hist site is giving NO canonical tags. Now I want to add canonical tag to his webiste since he have more than 3000+ posts. Is there a way or technique to get it back to default that is add “rel=canonical”

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

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

    Please refer to this filter to customize the filter tags. You may need to further edit this code as per your requirements.

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

    I would suggest inserting your code into a child theme file or using this plugin so you won’t lose any changes once there’s an update to your theme.

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

    Thanks.

    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 3 replies - 1 through 3 (of 3 total)

The ticket ‘canonical’ is closed to new replies.