Exclude Woo ?Filter from sitemap

#368990
  • Resolved Drew Praticante
    Rank Math free

    We’re getting a lot of ?filter_ in our sitemap index. How can this be removed as a URL? It’s taking up crawler’s time/resources (i.e. Google, Bing) for something that doesn’t need to be indexed. Google keeps putting it as Crawled – currently not indexed. Realistically, filter urls for PRODUCTS don’t need to be indexed.

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

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

    Please refer to this filter code to exclude filter URLs in your website:

    add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ){
    	if( strpos( $url['loc'], '?filter')){
    		return false;
    	}	
    	return $url;
    }, 10, 3 ); 

    The code needs to be inserted into your theme’s functions.php file.

    Let us know if it works on your end.

    Looking forward to helping you.

    Thank you. I will add it and see. Thanks again.

    Hello,

    Let us know how it goes.

    Meanwhile, if you have any other questions, please feel free to ask.

    We are here to help 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 3 replies - 1 through 3 (of 3 total)

The ticket ‘Exclude Woo ?Filter from sitemap’ is closed to new replies.