Product pages are being indexed

#31198
Viewing 1 replies (of 1 total)
  • Hello,

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

    The custom code on your theme does not check for the single products page. I’ve gone ahead and added an is_product() conditional to noindex the products on your site as shown below:

    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    if (is_paged() || 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=desc" ||  $_SERVER['QUERY_STRING'] =="orderby=price" || $_SERVER['QUERY_STRING'] =="orderby=rating" || $_SERVER['QUERY_STRING'] == "orderby=price-desc" ) {
    $robots['index'] = 'noindex';
    	return $robots;
    }
    return $robots;
    });

    Looking forward to helping you. Thank 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 1 replies (of 1 total)

The ticket ‘Product pages are being indexed’ is closed to new replies.