need to remove indexing for my woo commerce filter page

#434942
  • Resolved Mohammad Raza
    Rank Math free

    Hey there

    I am using the rank math plugin, I am facing an issue regarding the indexing. On my shop page, when I apply filters it generates a URL like this duvet-cover-sets/?filter_color=blush . which is been indexed on google. is there any way to remove no indexing for the filters .

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

    Thank you for contacting Rank Math and bringing your concern to our attention.

    In this case, you can use and customize this filter to set the ?filter search results on your site to noindex:

    add_filter( 'rank_math/frontend/robots', function( $robots ) {
      $url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
      if(strpos($url, '?filter')) {
        $robots["index"] = 'noindex';
        $robots["follow"] = 'nofollow';
      }
      return $robots;
    });

    The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    I hope that helps.

    This code will be applicable for woo commerce filters?

    Hello,

    Yes, it should also work for the Woocommerce page as long as the URL contains ?filter in it.

    Let us know how that goes.

    Looking forward to helping you on this one.

    Error image

    there is an issue with the canonical URL and it is indexing filters pages and other , do we have any solution to solve this ?

    I am having Canonical points to 4XX issues it is creating , 10000 url i dont know how can you please help me.

    Hello,

    Please share a couple of the affected URLs so we can check and assist you further.

    Looking forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘need to remove indexing for my woo commerce filter page’ is closed to new replies.