正如所解释的here
\'wpseo_sitemap_\' . $filter . \'_change_freq\'
the
$filter
应替换为要更改的帖子类型,您可以将其替换为:
homepage
,
blogpage
,
$post_type . \'_archive\'
,
$post_type . \'_single\'
,
$c->taxonomy . \'_term\'
,
author_archive
.
而$post_type
变量基于WordPress Codex 可替换为:
贴子(贴子类型:“贴子”)
页面(贴子类型:“页面”)附件(贴子类型:“附件”)修订版(贴子类型:“修订版”)导航菜单(贴子类型:“导航菜单项”)add_filter( \'wpseo_sitemap_post_single_change_freq\', \'my_custom_post_freq\', 10, 2 );
function my_custom_post_freq( $default, $url ) {
return \'hourly\';
}
将此添加到主题函数后,返回Yoast Seo插件后端,禁用XML站点地图功能,保存它,然后重新启用并重新加载
www.yoursite.com/post-sitemap.xml