msm-sitemap
msm-sitemap copied to clipboard
fixes #162, Conflicts with Wordpress 5.5 Sitemaps
Because Wordpress 5.5 is using the query var "sitemap" to generate the "wp-sitemap.xml" file there is a conflict with this plugin. Both are using the same query var.
This PR is updating the query var to "sitemap_msm".
Fixes #162. Should fix https://core.trac.wordpress.org/ticket/51136
When you merge this PR you can create a tag "1.5.0" to match the new plugin version?
Thanks.
The bug in core is still existing - https://core.trac.wordpress.org/ticket/51136 Can this get merged any time soon?
Have been using this patch in production and everything is working as expected.
Hey @rodruiz, thank you for submitting the PR! This solution seems to be a good fix, however, for compatibility reasons, changing the query var would bring some issues. For example, I tested this on a VIP Go environment, and it requires flushing the rewrite rules, otherwise example.com/sitemap.xml
will start showing WordPress's 404 page.
Since this would impact sites that aren't experiencing this issue, we believe that changing the query var is too risky. I believe the best path forward is to try to have the core bug patched, and in the meantime have the workaround in #161 merged, as it will not affect the sites that aren't experiencing this bug.
Have been using this patch in production for years (on VIP Go environments) and everything is working as expected.
@vaurdan yes, flushing the rewrite rules is required when you install and uninstall this plugin. On new installs, a site admin needs to manually flush the rewrites before use anyway.
Option 1: We can add an activation and deactivation hook to flush rewrite rules. Preferred.
- Actually there is a ticket #137 recommending this.
Option 2: Check when the plugin loads and flush rewrite rules automatically.
function msm_sitemap_check_rewrite_rules() {
if ( ! get_option( 'msm_sitemap_check_rewrite_rules', false ) ) {
update_option( 'msm_sitemap_check_rewrite_rules', true );
flush_rewrite_rules();
}
}
add_action( 'plugins_loaded', 'msm_sitemap_check_rewrite_rules' );