filter

jetpack_sitemap_url

Filter sitemap URL item before rendering it as XML.

Parameters

$tree
array

Associative array representing sitemap URL element.

$post_id
int

ID of the post being processed.

Changelog

How to use this hook

See “How to use actions and filters to customize Jetpack”.

Notes

You can use that filter to enter a custom value for one or multiple entries in the sitemap generated by Jetpack. In the example below, we’ll change the changefreq value for all posts, from monthly to daily:
function jeherve_custom_freq_posts_sitemaps( $url, $post_id ) {
	$type = get_post_type( $post_id );

	if ( 'post' == $type ) {
		unset( $url['changefreq'] );
		$url['changefreq'] = 'daily';
	}

	return $url;
}
add_filter( 'jetpack_sitemap_url', 'jeherve_custom_freq_posts_sitemaps', 10, 2 );