<?php
add_filter( "aioseo_sitemap_post", "aioseo_filter_sitemap_post", 10, 2 );
function aioseo_filter_sitemap_post( $entry, $postId ) {
if ( 10 === $postId ) {
// Set the language code for the main URL.
$entry['language'] = 'en_US'
// Add the translated versions (language code + URL).
$entry['languages'] = [
[
'language' => 'en_CA'
'location' => 'https://example.com/ca/page
],
'language' => 'en_UK'
'location' => 'https://example.com/uk/page
]
];
}
return $entry;