Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
I have entered the search term site:giggloshop.com/bird-feeder and this returns 3 results with none of the mentioned paginated pages. This seems to be working as expected. Please share some screenshots if your results are different.
Looking forward to helping you. Thank you.
Hi!
As you entere the search term site:giggloshop.com/bird-feeder you get three results. One of them is simple version and two of them shows perameters as ?orderby=date and ?orderby=rate. How can I set these two as no index with RankMath?
Hi there,
Thanks for the follow up.
I have modified the code you have on your functions.php file to check for query strings and set the pages to noindex like so:
/**
* Adjusting product page's robots
* @return string
*/
add_filter( 'rank_math/frontend/robots', function( $robots ) {
if (is_product() || $_SERVER['QUERY_STRING'] =="orderby=date" || $_SERVER['QUERY_STRING'] =="orderby=menu_order" || $_SERVER['QUERY_STRING'] =="orderby=popularity" || $_SERVER['QUERY_STRING'] =="orderby=popularity" || $_SERVER['QUERY_STRING'] =="orderby=price" || $_SERVER['QUERY_STRING'] == "orderby=price-desc" ) {
$robots['index'] = 'noindex';
$robots['follow'] = 'nofollow';
return $robots;
}
return $robots;
});
I hope this info helps. Thank you.
Hi! Thank you for the code but it worked partially and didn’t noindex order by rating querry. But I managed to figure it out and changed your code to following. `/**
* Adjusting product page’s robots
* @return string
*/
add_filter( ‘rank_math/frontend/robots’, function( $robots ) {
if (is_product() || $_SERVER[‘QUERY_STRING’] ==”orderby=date” || $_SERVER[‘QUERY_STRING’] ==”orderby=menu_order” || $_SERVER[‘QUERY_STRING’] ==”orderby=popularity” || $_SERVER[‘QUERY_STRING’] ==”orderby=popularity” || $_SERVER[‘QUERY_STRING’] ==”orderby=price” || $_SERVER[‘QUERY_STRING’] ==”orderby=rating” || $_SERVER[‘QUERY_STRING’] == “orderby=price-desc” ) {
$robots[‘index’] = ‘noindex’;
$robots[‘follow’] = ‘nofollow’;
return $robots;
}
return $robots;
});
`
Hi there,
Thanks for the follow up.
I am glad that this worked for you. If you want to set all the query params to noindex on your site, you could also do this:
add_filter( 'rank_math/frontend/robots', function( $robots ) {
if ($_GET) {
$robots['index'] = 'noindex';
$robots['follow'] = 'nofollow';
return $robots;
}
return $robots;
});
Feel free to contact us for any other issues. Thank you.