How to remove canonical from filter options

#198155
Viewing 8 replies - 1 through 8 (of 8 total)
  • KvdB
    Rank Math free

    Of course I mean that Rank Math puts the canonical there..

    Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for the delay.

    You can use and customize this filter to remove the canonical URL for your pages with filter:
    https://rankmath.com/kb/filters-hooks-api-developer/#6-filter-to-change-canonical-url

    And here’s a guide on how to use filters:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    I hope that helps.

    Thank you, and please don’t hesitate to contact us anytime if you need further assistance with anything else.

    KvdB
    Rank Math free

    Hi there, thanks for your answer but using this did not change anything, it still takes the base URL as canonical for the filter page. How can I remove the canonical tag from the filter pages?

    Hello,

    Thank you for the follow-up.

    That code needs to be customized before applying to your site.

    Unfortunately, we don’t offer code/filter customization given our small team. If you’re not a developer, you may need to hire a developer to assist you.

    As much as we would love to offer customized solutions to each and every user we have, it just isn’t possible for a small company like ours with limited resources.

    I hope that helps.

    Thank you.

    KvdB
    Rank Math free

    Hello! As it is not possible to customize it, how can we remove the canonical tags altogether?

    Hello,

    Thanks for getting back.

    You can copy the code given below and paste it into your theme’s/child theme’s functions.php file to remove the canonical tag from your site:

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

    You can customize this further to make it work only on your filter pages.

    Hope this helps. Let us know if you need any further assistance.

    KvdB
    Rank Math free

    Thanks for your help, now these work 🙂

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

The ticket ‘How to remove canonical from filter options’ is closed to new replies.