-
Hi,
I’ve noticed that every time I make any changes to my website (ie: activating or deactivating a plugin or emptying the pages cache) the sitemap_index.xml and its children disappear; therefore, I have to constantly flush my sitemap by saving the permalink under settings and sitemap settings within rank math.
In addition, I got W3 total cache plugin installed and within its minify and page cache settings I included the following:
First: Under “never minify the following pages:(shown below) I added these URL codes from a Yoast support page, guessing it might work
sitemap(_index)?\.xml(\.gz)?
[a-z0-9_\-]*sitemap[a-z0-9_\-]*\.(xml|xsl|html)(\.gz)?
([a-z0-9_\-]*)?\.xmlSecond: Under “Never cache the following pages: (Shown below) which I believe were properly added by your support some weeks ago.
wp-.*\.php
index\.php
sitemap_index.xml
page-sitemap.xml
post_tag-sitemap.xml
category-sitemap.xml
post-sitemap.xml
attachment-sitemap.xmlFinally, I read a post from Pratik somewhat related to my issue which consists in adding the code shown below in the website’s theme function; however, I’m unsure how to do this. Could I use the insert headers and footers plugin to achieve this?
Filter to enable/disable Sitemap caching.
/**
* Filter if XML sitemap transient cache is enabled.
*
* @param boolean $unsigned Enable cache or not, defaults to true
*/
add_filter( ‘rank_math/sitemap/enable_caching’, ‘__return_true’);
The ticket ‘Sitemap keeps dissappearing after any website change’ is closed to new replies.