Support » Plugin: Yoast SEO » Refresh sitemap after creating filters

  • Resolved dejudicibus


    Yoast SEO updates sitemaps if content is added, modified or deleted, but does NOT if a filter is added to functions.php. So, in such a case we need a way to force an uodate but it looks like there is no way to do it. Any idea?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Md Mazedul Islam Khan


    What filter are you referring here? Are you referring any filter that you’d add to your theme functions.php file and Yoast SEO sitemap will remove the transient cache?

    Yes, for example:

    if( ! function_exists('xxx_sitemap_exclude_post_type') ){
    	function xxx_sitemap_exclude_post_type( $value, $post_type ) {
    		$post_type_to_exclude = array('custompost1','custompost2');
    		if( in_array( $post_type, $post_type_to_exclude ) ) 
    			return true;
    	add_filter( 'wpseo_sitemap_exclude_post_type', 'xxx_sitemap_exclude_post_type', 10, 2 );
    Plugin Support Carl B


    You can force a cache reset of the sitemap by temporarily disabling the sitemap feature, and then re-enabling. To do so please perform the following steps:

      ​In WordPress go to SEO>Features
      ​Toggle the ‘XML Sitemaps’ option to ‘Off’
      ​Click ‘Save Changes’
      ​Toggle the ‘XML Sitemaps’ option to ‘On’
      ​Click ‘Save Changes’

    ​We also have a guide on how to enable and disable XML Sitemaps here:

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Refresh sitemap after creating filters’ is closed to new replies.