Turn Off Rank Math Sitemap Caching on Staging
Disables Rank Math's sitemap cache on local, development and staging sites, so sitemap changes show up immediately while you work.
Opens WPIDE on
Code
add_filter( 'rank_math/sitemap/enable_caching', function ( $enabled ) {
return 'production' === wp_get_environment_type() ? $enabled : false;
} );
Notes
Relies on WP_ENVIRONMENT_TYPE; production sites keep the cache.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.