It is important to maintain healthy xml sitemap for your site. In case you are using Yoast SEO plugin to generate xml sitemap for a wordpress site, it provides some hooks to override priority and change frequency of various urls.

Here is wordpress code snippet to customize xml sitemap generated by Yoast seo plugin.
add_filter('wpseo_sitemap_entry', 'my_sitemap_priority', 10, 3);
function my_sitemap_priority($url, $sitemap_type, $contextobj) {
$newurl = $url;
// tag sitemap
if ($sitemap_type == 'term') {
// change frequency
// replace this with your logic
$newurl['chf'] = 'daily';
// priority
// replace this with your logic
if ($url['pri'] <= 0.6) {
$newurl['pri'] += 0.2;
}
} else if (in_array($sitemap_type, array('post', 'page'))) {
// replace these with your logic
$newurl['chf'] = 'daily';
$newurl['pri'] = 0.8;
}
return $newurl;
}Few points to note
- $contextobj contains either $post or $tag object.
- The default priority and frequency should work in most cases. You should customize these only if you know what you are doing.
- Max priority value can be 1.0 and these values are only relative for all urls on your site.
- For more information you may want to see file class-sitemaps.php in your plugin directory.