Wordpress | Yoast SEO - Change slug or fragment in XML sitemap
<p><strong>Problem</strong>
Yoast SEO generates XML sitemap with links that lead to 404 errors.</p>

<p><strong>Because</strong>
I'm using WPML and some str_replace scripts in my functions.php to rewrite slugs/permalinks. The XML sitemap generator by Yoast SEO is not using those scripts in my functions.php, so it generates non-valid links.</p>

<p>My str_replace scripts is changing the custom post type slug:</p>

<p><strong>English</strong>
<em>domain.com/news/taxo_en1/taxo_en2/title</em></p>

<p><strong>Dutch</strong>
<em>domain.com/nl/nieuws/taxo_nl1/taxo_nl2/titel</em></p>

<p>And the XML Sitemap is showing this
<strong>Dutch</strong>
domain.com/nl/news/taxo_nl1/taxo_nl2/titel </p>

<p>Is there a way to change the generated links in the XML sitemap? With a wpseo_do_sitemap hook or?</p>