How do you exclude a post type or category from the Yoast sitemap?

Yoast’s sitemap follows its search visibility settings. To exclude an entire post type or taxonomy, open the relevant Yoast search appearance settings and disable its appearance in search results. The plugin then applies noindex behavior and removes those URLs from the XML sitemap.
For one page, post, or term, use the Advanced controls in its Yoast panel and set it not to appear in search results. Update the item and verify both the page’s robots directive and the relevant sitemap. Excluding a URL from the sitemap alone would not prevent indexing if search engines can discover it through links.
Use this setting for content that should remain accessible to visitors but has no search value, such as thin internal archives. Do not noindex a category that supports important navigation without checking its traffic and internal links. Clear caches after the change, and make sure no second sitemap plugin continues to list the excluded URLs.