title: Yoast sitemap shows old URL and new URL
body: <p>We have renamed some of our pages and changed the slugs. The Yoast xml sitemap is now showing both the old name and new name as separate pages.</p>
  <p>I busted the cache, turned sitemap feature on and off, turned plugin on and off, yet it is still there.</p>
  <p>We are using a redirection plugin “Redirection” to direct old name to new name.</p>
  <p>I do see there are hooks I can add for the page ID (<a href="https://developer.yoast.com/features/xml-sitemaps/api/#exclude-specific-posts" rel="nofollow noreferrer">https://developer.yoast.com/features/xml-sitemaps/api/#exclude-specific-posts</a>). I don’t want to exclude the page ID though (as it has a new name) I want to just exclude the old slug. Does anyone have experience with this?</p>
  <p>I have read the other topics here and they do not have the solution.</p>
  <p>this is the exclude by ID code, can it be modified?</p>
  <pre><code>/**
   * Excludes posts from XML sitemaps.
   *
   * @return array The IDs of posts to exclude.
   */
  function exclude_posts_from_xml_sitemaps() {
      return [ 1, 2, 3 ];
  }
  
  add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', 'exclude_posts_from_xml_sitemaps' );
  </code></pre>