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

fixes #162, Conflicts with Wordpress 5.5 Sitemaps #163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rodruiz
Copy link

@rodruiz rodruiz commented Sep 3, 2020

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
Copy link
Author

rodruiz commented Sep 3, 2020

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

Thanks.

@mehigh
Copy link

mehigh commented Jan 5, 2021

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

@rodruiz
Copy link
Author

rodruiz commented Jan 5, 2021

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

@vaurdan
Copy link
Member

vaurdan commented Feb 25, 2021

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.

@rodruiz
Copy link
Author

rodruiz commented Sep 29, 2023

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.

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

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

Successfully merging this pull request may close these issues.

Conflicts with Wordpress 5.5 Sitemaps
3 participants