How to Change Yoast SEO Sitemap Frequency And Priority

Sarmad Gardezi

To Change Yoast Sitemap Frequency And Priority you need to use a little bit of custom code (using filters). Thankfully there is some documentation out there about it (links: change sitemap frequency documentationchange sitemap priority documentation) though it’s not good documentation and it’s rather confusing. So let’s demystify this code and let you quickly and easily change Yoast sitemap frequency and priority.

Adding custom code should be done by using a custom ‘functions.php‘ file in your child theme, though if you don’t know what a child theme is or how to make a fuctions.php file, or are afraid to touch code via ftp, that’s ok you can use a very handy plugin called My Custom Functions. It’s a plugin I’ve used on several client sites and it works great since then I don’t need any FTP access and can add custom code through that function … which as you can image makes life a lot easier.

There are two parts to this post: changing the sitemap update frequency and changing the sitemap priorities for updates. Let’s start with frequency.

Change Yoast SEO Sitemap Frequency

This one is the more confusing of the two because of how you have to use it. The documentation says that the function name looks like this:

'wpseo_sitemap_' . $filter . '_change_freq'

The problem is what does ‘$filter’ mean, how do we use it and what are our options?

We’re also told that our choices for what value to return (meaning what frequency to set) are limited to:

'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'

Before we go any further I need to explain something to you: thankfully the content of our custom code (where we return the result) is very very simple, though it can be more complex depending on how much heavy filtering you want to do. Our whole custom function is one single line of code: return the desired frequency rate text.

Thus, our custom function will look something like (if we want to change the frequency to be daily for example):

function my_custom_freq( $default, $url ) {
return 'daily';

When I say “page/post/thing type” … that’s what will go and replace the “$filter” that we talked about in the beginning.

Your basic option for $filter are (but not limited to):

  • homepage
  • blogpage
  • post_archive
  • page_archive
  • post_single
  • page_single
  • author_archive

See a pattern forming here? Thus based on the content and setup of your WordPress site you can have $filter be something such as:

  • product_single
  • product_archive
  • product_cat_single
  • product_brand_single
  • mycustomposttype_single
  • mycustomposttype_archive

and so on. But wait! There’s more … well, one more (for now):

  • postTaxonomy_term

Where ‘postTaxonomy’ would be that post types category or tag general name, for example (using WooCommerce Product Brands) we could have “wpseo_sitemap_product_brand_term_change_freq” since Product Brand is yet another type of categorization you can do in WooCommerce (if you get the brands plugin).

Thus the full line would be something like:

add_filter( 'wpseo_sitemap_product_single_change_freq', 'my_custom_freq', 10, 2 );

After that alot of my hard work and research i get to know that you can also change the Fetch time so the code is listed below for that.

add_filter( 'wpseo_sitemap_blogpage_change_freq', 'my_custom_freq', 10, 2 );

function my_custom_freq( $default, $url ) {
return 'daily';

If you want to have the frequency be daily for more thing you do not have to rewrite all that code, simply add another filter for your wanted post type thingy and point it towards your custom function:

add_filter( 'wpseo_sitemap_product_single_change_freq', 'my_custom_freq', 10, 2 );
add_filter( 'wpseo_sitemap_homepage_change_freq', 'my_custom_freq', 10, 2 );
add_filter( 'wpseo_sitemap_blogpage_change_freq', 'my_custom_freq', 10, 2 );
add_filter( 'wpseo_sitemap_post_single_change_freq', 'my_custom_freq', 10, 2 );
add_filter( 'wpseo_sitemap_product_archive_change_freq', 'my_custom_freq', 10, 2 );
add_filter( 'wpseo_sitemap_page_single_change_freq', 'my_custom_freq', 10, 2 );
add_filter( 'wpseo_sitemap_product_brand_term_change_freq', 'my_custom_freq', 10, 2 );
add_filter( 'wpseo_sitemap_product_cat_term_change_freq', 'my_custom_freq', 10, 2 );

function my_custom_freq( $default, $url ) {
return 'daily';

Change Yoast SEO Sitemap Priority

This one, at least I think so, is pretty simple. We have two functions we can filter on: either for the single posts or for the archives.


There’s no name changing or anything here just two simple filters. I’ll use the sitemap_post filter in our example:

add_filter( 'wpseo_xml_sitemap_post_priority', 'my_custom_post_xml_priority', 10, 3 );

function my_custom_post_xml_priority( $return, $type, $post) {
if ($type == 'page')
$return = 0.6;
else if ($type == 'post')
$return = 0.8;
else if ($type == 'product')
$return = 0.8;
return $return;

At the top we simple call the filter just once, no more is needed, and then do the filtering inside the code. In this example I simply filter by the post type. To help explain the code:

  • We named our custom function “my_custom_post_xml_priority”.
  • It accepts three parameters: the return value, the post type and the actual post
  • Inside the code we set the return value ($return) based on the post type we’re filtering for
  • The value can only be between 0 and 1 (between 0.00 and 1.00 .. two point decimal)
  • And then we simply return the value named $return.

Simple. 🙂

This was new to me and for everyone who dont want Yoast to take a whole weak to index their sitemap file. Hope so it will be helpful is have any Issue you can email me