msm-sitemap icon indicating copy to clipboard operation
msm-sitemap copied to clipboard

fixes #162, Conflicts with Wordpress 5.5 Sitemaps

Open rodruiz opened this issue 4 years ago • 5 comments

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

rodruiz avatar Sep 03 '20 18:09 rodruiz

When you merge this PR you can create a tag "1.5.0" to match the new plugin version?

Thanks.

rodruiz avatar Sep 03 '20 18:09 rodruiz

The bug in core is still existing - https://core.trac.wordpress.org/ticket/51136 Can this get merged any time soon?

mehigh avatar Jan 05 '21 07:01 mehigh

Have been using this patch in production and everything is working as expected.

rodruiz avatar Jan 05 '21 09:01 rodruiz

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.

vaurdan avatar Feb 25 '21 15:02 vaurdan

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' );

rodruiz avatar Sep 29 '23 20:09 rodruiz