Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#61293 new enhancement

Display an empty sitemap instead of 404

Reported by: cybr's profile Cybr Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Sitemaps Keywords:
Focuses: Cc:


The sitemap can be empty when something filters its contents (I do that with The SEO Framework via indexability checks, such as "noindex").

When the sitemap is empty, WP_Sitemaps::render_sitemaps() currently bails to a 404.
I recommend sending an empty sitemap instead.

This change aligns with the user's expectations: They can actually see the sitemap and understand it is empty instead of "not working, eh, where do I start?".

Also, with the change, Google Search Console will say, "Sitemap can be read, but has errors" instead of "Sitemap could not be read". The former is a bit more descriptive of the situation.

Change History (1)

#1 @Cybr
4 weeks ago

The support topic that motivated me to create this ticket: We get about one or two of these every month.

Last edited 4 weeks ago by Cybr (previous) (diff)
Note: See TracTickets for help on using tickets.