This should work. Just did for me:
function sitemap_exclude_taxonomy( $value, $taxonomy ) {
if ( ‘scope’ == $taxonomy
|| ‘layout_type’ == $taxonomy
|| ‘module_width’ == $taxonomy )
return true;
}
add_filter( ‘wpseo_sitemap_exclude_taxonomy’, ‘sitemap_exclude_taxonomy’, 10, 2 );
First mistake I made was not choosing the correct theme to edit under ‘Appearance > editor’
Once I had the correct theme it still wouldn’t show the correct sitemap, figured maybe Yoast has some sort of caching, maybe not, but either way I then also went ahead and did this too…
Went back into the Yoast sitemap settings and turned off the sitemaps feature. Saved. Refreshed my cache settings via my webproxy firewall, then turned the Yoast sitemap feature back on and saved.
Checked my new sitemap.xml file and it was good! Only the two types I wanted now showed up. The rest were gone.
Good luck!