Product pages are being indexed

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.

    ​​​​​​​

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.