Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The site map links does not included in rewrite rules for heartbeat requests #291

Open
osamaalsabbagh opened this issue Oct 22, 2024 · 1 comment

Comments

@osamaalsabbagh
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@osamaalsabbagh and others