Noindexed WooCommerce products still in sitemap

#16924
  • Resolved Spinifex Media
    Rank Math free

    Hi there,
    Managing a fairly new WooCommerce store with ~1900 products. Many of the products are “children” of a grouped product parent, however, as the products were imported in bulk we’ve used a conditional around one of Rank Math’s robots filters to make those child entries noindex:

    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    	
     global $post, $product;	
     if ( has_term( 'exclude-from-search', 'product_visibility' ) || has_term( 'exclude-from-catalog', 'product_visibility' ) ) {
    	
     $robots['index'] = 'noindex';
     $robots['follow'] = 'nofollow';
    
     }
    
     return $robots; 

    The issue we’re facing is the filter doesn’t also remove those products from the sitemap, so we’re now generating “submitted URL marked ‘noindex'” errors in Search Console.

    Aside from editing each of the child products directly in the dashboard (ugh!) which DOES remove the entries from the sitemap, is there a way for us to force exclude those noindexed entries from the sitemap? Another filter, or method to the same end?

    Thanks for your insight!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

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

    Unfortunately, we do not have any approach from the Rank Math API that would assist with such a setup, you would need to implement some custom code to loop through the posts and update the values.

    Apologies for the inconvenience.
    ​​​​​​​

    Thanks Michael

    Michael Davis
    Rank Math pro

    Hello,

    Thank you for getting back to us.

    You are most welcome, feel free to let me know in case something else comes up 🙂

    Looking forward to helping you. Thank you.

    ​​​​​​

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Noindexed WooCommerce products still in sitemap’ is closed to new replies.