I'm in the process of overhauling my site and I need to make sure Google is getting the most recent versions throughout the process. I'm using WordPress with the Yoast SEO plugin.

In their knowledge base, they even link to a handy post from this site detailing how to change post check frequencies using functions.php

I tried following the example but it was in vain. I just want all posts to be checked hourly. So I did this:

add_filter( 'wpseo_sitemap_post_change_freq', 'my_custom_post_freq', 10, 2 );

function my_custom_post_freq( $default, $url ) {
    return 'hourly';

The sitemaps generated by Yoast still show "weekly." I've tried disabling and re-enabling it.


As it is explained here

'wpseo_sitemap_' . $filter . '_change_freq'

the $filter should be replaced with post type that you want to change, you can replace it with:



$post_type . '_archive',

$post_type . '_single',

$c->taxonomy . '_term',


while the $post_type variable based on WordPress Codex can be replaced with:

  • Post (Post Type: 'post')
  • Page (Post Type: 'page')
  • Attachment (Post Type: 'attachment')
  • Revision (Post Type: 'revision')
  • Navigation menu (Post Type: 'nav_menu_item')

at the end for single post your code should look like:

add_filter( 'wpseo_sitemap_post_single_change_freq', 'my_custom_post_freq', 10, 2 );

  function my_custom_post_freq( $default, $url ) {

    return 'hourly';


After adding this to your theme functions go back to Yoast Seo plugin back-end, disable XML sitemap functionality, save it, then re-enable and reload www.yoursite.com/post-sitemap.xml

  • Thank you! Works like a charm. I'm not the best with PHP. I appreciate the help. – TrueNorthTimes Jul 11 '15 at 19:40
  • You are welcome @TrueNorthTimes, I'm glad that it helped you. – emilushi Jul 11 '15 at 22:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.