WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

#50515 closed defect (bug) (invalid)

redirect_sitemapxml should exit if wp_sitemaps_enabled is false

Reported by: jonoaldersonwp Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Sitemaps Keywords: close
Focuses: Cc:

Description (last modified by jonoaldersonwp)

When XML sitemaps are disabled via wp_sitemaps_enabled, redirect_sitemapxml still runs and redirects requests from /sitemap.xml to /wp-sitemap.xml.

This is unintended behaviour; if the sitemaps are disabled, this redirect should be disabled.

See https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/sitemaps/class-wp-sitemaps.php#L205

Change History (4)

#1 @SergeyBiryukov
8 months ago

  • Milestone changed from Awaiting Review to 5.5

#2 @jonoaldersonwp
8 months ago

  • Description modified (diff)

#3 @swissspidy
8 months ago

  • Keywords close added
  • Severity changed from major to normal

As discussed on Slack, the WP_Sitemaps class (and thus this redirect handler) is only initialized when wp_sitemaps_enabled is true, so this seems like a non-issue to me.

#4 @jonoaldersonwp
8 months ago

  • Milestone 5.5 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Agreed; reasonably convinced that this showed up in testing due to browser caching of the previously active 301.

Note: See TracTickets for help on using tickets.