Support » Plugin: Yoast SEO » Exclude post categories from sitemap

  • Resolved dejudicibus


    I have two post categories, ‘red’ and ‘blue’, subcategories of ‘color’, that I wish to exclude from post sitemap. I tried the following but it does NOT work:

    if( ! function_exists('custom_sitemap_exclude_taxonomy') ){
    	function custom_sitemap_exclude_taxonomy( $value, $taxonomy ) {
    		$taxonomy_to_exclude = array('red','blue');
    		if( in_array( $taxonomy, $taxonomy_to_exclude ) ) 
    			return true;
    	add_filter( 'wpseo_sitemap_exclude_taxonomy', 'custom_sitemap_exclude_taxonomy', 10, 2 );

    I also tried the following

    $taxonomy_to_exclude = array('color/red','color/blue');

    but it does not work too. What did I wrong?

Viewing 1 replies (of 1 total)
  • Plugin Support Md Mazedul Islam Khan


    We can’t offer support on custom code (needed to change (core) features of our plugin). Since we don’t want to take the risk that we break your website by suggesting incorrect or incomplete code, we cannot advise you on how to make such changes. Maybe someone watching these forums can assist you further, but if your topic is inactive for 7 days, we’ll mark it as resolved to keep the overview.

    Thank you for your understanding.

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude post categories from sitemap’ is closed to new replies.