This was useful. Thanks. It allows for edits of pages/posts within WordPress to be removed from sitemap XML’s. If the pages and posts do not exist in WordPress
1)I should use
add_filter( ‘wpseo_exclude_from_sitemap_by_post_ids’, function () {
return array( 311, 322 );
} ); ?
2) In what PHP program should these filters live?
I have 12 sitemap XML’s is their an easier way to edit them?
Thanks
The functions.php file can be found in my theme and three versions under wordpress-seo , so I am not sure which to use?
@stephose You can control what content types are included in the sitemap in the settings located in the SEO>Search Appearance area. To customize what types of pages or content are included in the sitemap you would need to perform the following steps:
In WordPress, go to SEO>Search Appearance
Click on the appropriate tab to add or remove certain post types from the search results. Removing a post type from the search results will also remove them from the sitemap.
Click ‘Save Changes.’
We also have additional information on configuring your XML Sitemap located at the following link: https://kb.yoast.com/kb/how-to-customize-the-sitemap-index/
As for using the wpseo_exclude_from_sitemap_by_post_ids filter, you would want to add that your theme’s functions.php file.
Thanks for that information. I consider call closed