Hi @mapdi
we need to check for the correct query_var
.
For Google XML Sitemap this is defined here:
https://github.com/Auctollo/google-sitemap-generator/blob/dbca6fc9b9dd8cd0cd9e63758650d3f727d99683/class-googlesitemapgeneratorloader.php#L104-L114
And the rewrite rules are defined after that.
Now we need to look which query_var
RankMath is using. Looks like this is defined here:
https://github.com/rankmath/seo-by-rank-math/blob/eea089f0afe7f476d1f9dadc1a9f75377373d282/includes/modules/sitemap/class-router.php#L40-L54
So I would try one of those three query_vars
. Maybe sitemap_n
:
/*
* Cachify: Do note cache XML Sitemap Rank Math
*/
if (defined('CACHIFY_FILE')) {
add_filter(
'cachify_skip_cache',
function() {
global $wp_query;
return !empty($wp_query->query_vars["sitemap_n"]);
}
);
}
Can you please try this and report back if this works?
Thanks in advance!
All the best
Torsten