-
Hello, we use TranslatePress, but we do have pages that are specific to certain languages.
I want to remove the urls that are created that we dont want from the sitemap.For example, I create the page
/marketing-united-states/
Now TranslatePress creates/sv/marketing-united-states/as well and adds it to the sitemap. On the frontend we just redirect the page to/sv/. But of course it is still added to the sitemap.What I tried:
add_filter( 'rank_math/sitemap/xml_post_url', function( $url, $post){
if('https://<domain>/sv/marketing-united-states/' !== $url) {
return $url;
}
}, 10, 2 );
This did not work, it did work however when trying with a default language page. That indicates that the entries added to the sitemap for the translated pages somehow overwrite the above filter.
Do you have any ideas what we can do to hide these translated entries?
The solution needs to account for when the page is only in one of the translated languages as well, for example:/marketing-stockholm/<- be able to remove from sitemap
/sv/marketing-stockholm/<- be able to keep in sitemap when above is removedThanks in advance!
You must be logged in to reply to this ticket.