How To Exclude Pages or Posts From Sitemap in Wordpress?
am using this code to exclude post related to particular category or tag from sitemap. but not working
function sitemap_exclude_taxonomy( $value, $taxonomy ) {
if ( $taxonomy == 'xxx' ) return true;
}
add_filter( 'wpseo_sitemap_exclude_taxonomy', 'sitemap_exclude_taxonomy', 10, 2 );
You can follow the steps mentioned here to exclude a specific page / post from the sitemap. https://kb.yoast.com/kb/sitemap-shows-excluded-posts-pages/