Here’s the way. There is an error in the copy-paste that I will report to the developers.
If you have a look at plugins/transposh/wp/transposh_3rdparty.php you’ll notice this (line 216):
/**
* This function integrates with yoast sitemap generator, and adds for each viewable language, the rest of the languages url
* Also – priority is reduced by 0.2
* And this requires the following patch in class-sitemaps.php
* For future yoast versions, and reference, look for this function:
if ( ! in_array( $url[‘loc’], $stackedurls ) ) {
// Use this filter to adjust the entry before it gets added to the sitemap
$url = apply_filters( ‘wpseo_sitemap_entry’, $url, ‘post’, $p );
if ( is_array( $url ) && $url !== array() ) {
$output .= $this->sitemap_url( $url );
$stackedurls[] = $url[‘loc’];
}
}
And change to:
if ( ! in_array( $url[‘loc’], $stackedurls ) ) {
// Use this filter to adjust the entry before it gets added to the sitemap
$url = apply_filters( ‘wpseo_sitemap_entry’, $url, ‘post’, $p );
if ( is_array( $url ) && $url !== array() ) {
$output .= $this->sitemap_url( $url );
$stackedurls[] = $url[‘loc’];
}
$langurls = apply_filters( ‘wpseo_sitemap_language’,$url);
if ( is_array( $langurls )) {
foreach ($langurls as $langurl) {
$output .= $this->sitemap_url( $langurl );
}
}
But there is an error in the code provided (missing bracket). This is the working code:
if ( ! in_array( $url['loc'], $stackedurls ) ) {
// Use this filter to adjust the entry before it gets added to the sitemap
$url = apply_filters( 'wpseo_sitemap_entry', $url, 'post', $p );
if ( is_array( $url ) && $url !== array() ) {
$output .= $this->sitemap_url( $url );
$stackedurls[] = $url['loc'];
}
} // ******* this one was missing
$langurls = apply_filters( 'wpseo_sitemap_language',$url);
if ( is_array( $langurls )) {
foreach ($langurls as $langurl) {
$output .= $this->sitemap_url( $langurl );
}
}