aioseo_sitemap_term

This filter can be used to advertise the translated versions of a term so that these can be included in the multilingual sitemap of AIOSEO.

Parameters (3)

$entry (array)
The sitemap entry data.

$termId (int)
The term ID.

$taxonomy (string)
The taxonomy.

Example code snippet

The code snippet below can be used to add translated versions for a specific term sitemap entry.

add_filter( "aioseo_sitemap_term", "aioseo_filter_sitemap_term", 10, 2 );

function aioseo_filter_sitemap_term( $entry, $termId ) {
	if ( 12 === $termId) {
		// 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;
}

Changelog

VersionDescription
4.2.2Introduced.