Delete all canonical

  • Hello, how can I remove all canonical links on the site? And is it possible to specify custom canonical urls on filter results pages?

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

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

    Rank math adds self canonical URLs to all pages set to index. You can also specify custom canonical on the individual pages under the Advanced tab of Rank math meta box: https://i.rankmath.com/yRtXjc . You should however note adding a custom URL this way may keep a page from being added to the sitemap as this is usually intended for duplicate pages.

    You can however specify the canonical using this filter:

    
    /**
     * 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. If you have any further question(s), please let us know. Thank you.

    Hello it didn’t work. Maybe I am doing something wrong, but the canonical url all stayed.

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

You must be logged in to reply to this ticket.