The site map links does not included in rewrite rules for heartbeat requests
-
Hi,
I noticed that when the request contains $_POST[‘action’]=’heartbeat’ and rewrite rules option is updated in that request the rewrite_rules option will be saved without these sitemap rules:[sitemap_index.xml$] => index.php?sitemap=1
[([^/]+?)-sitemap([0-9]+)?.xml$] => index.php?sitemap=$matches[1]&sitemap_n=$matches[2]
[([a-z]+)?-?sitemap.xsl$] => index.php?xsl=$matches[1]
[locations.kml$] => index.php?sitemap=locations
After debugging the code I found that the constructor of:
seo-by-rank-math/includes/module/class-manager.php
has this code:public function __construct() {
if ( Helper::is_heartbeat() ) {
return;
}$this->action( ‘plugins_loaded’, ‘setup_modules’ );
$this->filter( ‘rank_math/modules’, ‘setup_core’, 1 );
$this->filter( ‘rank_math/modules’, ‘setup_admin_only’, 1 );
$this->filter( ‘rank_math/modules’, ‘setup_internals’, 1 );
$this->filter( ‘rank_math/modules’, ‘setup_3rd_party’, 1 );$this->action( ‘plugins_loaded’, ‘load_modules’ );
add_action( ‘rank_math/module_changed’, [ ‘\RankMath\Admin\Watcher’, ‘module_changed’ ], 10, 2 );
$this->action( ‘rank_math/module_changed’, ‘watch_for_analytics’, 10, 2 );
}From the code, it appears that when the request is identified as a heartbeat (
Helper::is_heartbeat()
), the function exits early without adding the sitemap rules.Can you please confirm if this is the intended behavior, or if there is a workaround to ensure that the sitemap rules are properly added even when a heartbeat request updates the rewrite rules?
Thank you for your assistance.
- You must be logged in to reply to this topic.