Hello,
We apologize for the issue you are facing with filter pages being indexed in Google search results. To prevent pages with filters from being indexed while still allowing paginated pages to be indexed, you can set a noindex tag for those filtered pages in WooCommerce using Rank Math. Here’s how you can do it:
- Navigate to Rank Math Settings: Go to your WordPress Dashboard and click on Rank Math SEO.
- Titles & Meta: Click on Titles & Meta.
- Product Archives: Look for the Product Archives section.
- Robots Meta: In this section, you will find options for setting the indexing behavior of your product archives. You can enable the No Index option for filtered pages.

- Save Changes: Don’t forget to save your changes after making adjustments.
By doing this, you will ensure that the filtered pages do not get indexed by search engines, while still allowing your paginated pages to be indexed as desired.
If you have any further questions or need assistance, feel free to reach out again. Thank you for raising this concern!
Sources:
How Rank Math Prevents Duplicate Content Issues in a WooCommerce Store » Rank Math
Hello,
Could you please share the example filtered URLs so we can check as well?
Meanwhile, you may use and customize this code to set those filtered URLs to noindex:
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = home_url( $_SERVER['REQUEST_URI'] );
if (strpos($url,'?attribute_pa') !== false)) {
$robots['index'] = 'noindex';
$robots['follow'] = 'follow';
return $robots;
}
return $robots;
});
You may refer to this guide on how to add filters to your website:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Looking forward to helping you.
Hello,
You should modify the condition statement to check for a string that is consistent in all the filter URLs. For instance, you can try:
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = home_url( $_SERVER['REQUEST_URI'] );
if (strpos($url,'filter') !== false)) {
$robots['index'] = 'noindex';
$robots['follow'] = 'follow';
return $robots;
}
return $robots;
});
Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.
Hey there. Thanks for your replies will definetly try them. For now i used this code for every attribute i have on site. example for 2 attributes below. should i just use filter as mentioned above and it will count for all attributes?
add_filter( ‘rank_math/frontend/robots’, function( $robots ) {
$url = home_url( $_SERVER[‘REQUEST_URI’] );
if ((strpos($url,’filter_color’) !== false)) || (strpos($url,’filter_size’) !== false)) {
$robots[‘index’] = ‘noindex’;
$robots[‘follow’] = ‘follow’;
return $robots;
}
return $robots;
});
Hello,
The code you provided will only activate for URLs that have been filtered by color. Additionally, the previous code will trigger for any URLs containing the word “filter,” which may lead to false positives. Instead, consider using filter_
or &filter_
, as these options should rarely produce false positives.
We hope this clarifies the issue. Please let us know if you have any further questions or concerns.
Thanks for your immediate responses. will try that!
Hello again. I use the code but when inspecting the page it still shows index to filtered pages. cache has been cleared. something is overiding the code. Should i set archived pages to noindex? but i still want ccategory pages to show on google results.
Thanks in advance
snippet was deactivated by mistake
mark as solved.
Hello,
We are super happy that we have addressed your concern. If you have any other questions in the future, know that we are here to help you.
If you don’t mind us 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.