Sometimes, you need to hide certain post types from Google Search Console, Google search results, your website’s search results, or you don’t want them in your sitemap.
It’s really easy to do this. You simply need to change a small attribute when you register your post type in WordPress.
By doing this, you will exclude your post type from your public queries and it will no longer be visible in the sitemap.xml file.
If you want to exclude the post type from your website search results, you can check exclude_from_search and it will no longer be listed when someone searches for a match on your website.