Single Product Pages are not being set to no-index

#8891
  • Resolved Aqib Sharif
    Rank Math free

    Hi!
    I have setup products meta as no-index because I don’t want to index my products. I have checked source code of pages and still shows robots meta as index. If I manually set each product as noindex it works well but there are thousands of products and I can not manually noindex each product.

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.

    I have added the following code to your theme to make all your product pages noindex/nofollow:

    /**
    * Adjusting product page's robots
    * @return string
    */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    if ( is_product() ) {
    $robots['index'] = 'noindex';
    $robots['follow'] = 'nofollow';
    }
    return $robots;
    });

    I hope this info helps. 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 ‘Single Product Pages are not being set to no-index’ is closed to new replies.