Tell us what you are trying to do?
I want to selectively eliminate some custom post types from this sitemap file: hidden link for which a custom field called "Show on website" (slug: show-on-website) is "No".
I already have included this meta tag using dynamic conditions (it only shows when flag above is "no"):
<meta name="robots" content="noindex">
Is there any documentation that you are following?
None
Is there a similar example that we can see?
None that I'm aware of
What is the link to your site?
hidden link
Hello,
It depends on the sitemap plugin you are using.
I assume you are using Yoast SEO plugin to generate the XML sitemap, you can follow their document to exclude those posts which custom field "show-on-website" values are "No":
hidden link
section "Exclude specific posts"
You can get all post IDs which custom field "show-on-website" values are "No" using WordPress built-in class WP_Query:
https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters
One thing need to pay attention:
If the custom field "show-on-website" is created with Toolset Types plugin, in your custom PHP codes, you need to add "wpcf-" prefix before field slug, for example: "wpcf-show-on-website"
https://toolset.com/documentation/customizing-sites-using-php/functions/