@homu9 Can you please let us know how the URL is being redirected? Is it being done by another WordPress plugin?
As for removing it from the sitemap, if you are still seeing a URL in the sitemap that should not be included we would first recommend checking your caching settings and to ensure that the sitemap is being excluded from the cache. If the sitemap is being cached by a plugin we have directions on how to add an exclusion for the sitemap files to your cache plugin at the following link: ?https://kb.yoast.com/kb/exclude-sitemaps-from-cache/
If you are still experiencing an issue with the sitemap not updating after checking your caching settings, you can also force a cache reset by temporarily disabling the sitemap feature, and then re-enabling. To do so please perform the following steps:
? In WordPress go to SEO>General>Features
? For ‘XML Sitemaps’ Toggle the switch to ‘Disabled.’
? Click ‘Save Changes.’
? Toggle the switch back to ‘Enabled.’
? Click ‘Save Changes.’
?Yoast SEO does not cache sitemaps, so if you find that the sitemap is being cached we would recommend ensuring that the sitemaps are excluded from caching on your site. We have a guide on how to exclude your site’s sitemaps caching for a variety of plugins and caching types at the following link: https://yoast.com/help/exclude-sitemaps-from-cache/. If you don’t see the type of caching your site is using listed there, you may need to contact your hosting provider for assistance.
?
Also, if you are still not able to get the URL to be removed from the sitemap, you can also manually remove a post from the sitemap by using the wpseo_exclude_from_sitemap_by_post_ids
developer filter, which excludes posts from the sitemap by their Ids. The filter would need to be placed in your functions.php
file. If you are uncertain where your functions.php
file is or how to edit it, please contact your theme developer for additional assistance.
Below is an example use of the filter, where the post IDs to be excluded are 1 and 17:
add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', function () {
return array( 1, 17 );
} );