Fix it

WordPress sitemap returns 404: find the layer that drops the request

A 404 on the sitemap means your site is answering and not finding it. That is different from Search Console failing to fetch a sitemap. Work through the request path from WordPress outward.

By Adem ÇakalPublished 3 sources5 min read
Short answer

Find out which sitemap URL you are testing, then work outward. Core WordPress serves /wp-sitemap.xml. A plugin may replace it with its own URL and turn the core one off. If the URL that should exist returns 404, check in this order: Site Visibility, the plugin filter that disables core sitemaps, a permalinks flush, then server rewrite rules.

Symptom to cause

SymptomCauseFix
Every pretty URL 404s, not only the sitemapStale or missing rewrite rulesSettings, Permalinks, Save Changes
/wp-sitemap.xml 404s, plugin sitemap worksPlugin replaced the core sitemapSubmit the plugin's URL instead
Both sitemaps 404 on a new siteDiscourage search engines is tickedSettings, Reading, untick it
Sitemap 404 after a plugin was deactivatedPermalinks plain, or leftover ruleEnable pretty permalinks and flush
Only .xml files 404Server config handles .xml before WordPressFix the rewrite or location rule
Sitemap 404 for logged-out visitors onlyCache, firewall or maintenance pluginTest in a private window; purge cache

The request path

A sitemap request passes the CDN or cache, the web server rewrite, WordPress rewrite rules and the sitemap provider; a 404 can come from any layer CDN / cachestale 404 stored Web serverrewrite to index.php WordPress rulespermalinks, visibility Sitemap providercore or plugin A 404 can be produced at any box. Test from the left to see where it first appears.
Request path as we describe it; layer names vary by host.

Check one: which sitemap should exist?

Open /robots.txt. WordPress adds a sitemap line automatically for the core sitemap, and SEO plugins add theirs. The URL listed there is the one that should answer with 200. Then run it through the sitemap checker, or from a terminal:

curl -sI https://example.com/wp-sitemap.xml | head -n 1
curl -sI https://example.com/sitemap_index.xml | head -n 1

Check two: visibility and plugin filters

WordPress core documentation says sitemaps are disabled when Site Visibility is set to discourage search engines. It also says the wp_sitemaps_enabled filter can override the default. A plugin or custom code returning false from that filter turns the core sitemap off. To test, deactivate plugins one group at a time, and reload the URL after each. Search your theme or an mu-plugin for the filter name:

grep -R "wp_sitemaps_enabled" wp-content/ --include=*.php

Go to Settings, Permalinks and click Save Changes without altering anything. That regenerates the rewrite rules. If your permalink setting is Plain, switch to a named structure; a core contributor advised that pretty permalinks be enabled in a related plugin case. Plain permalinks may not route the sitemap path.

Check four: server rules

On Apache, confirm the standard WordPress block exists in .htaccess and that mod_rewrite is on. On nginx, the location / block needs a try_files line that falls back to /index.php. A static-file rule that matches .xml and returns 404 before WordPress sees it is the usual culprit in that case. We cannot see your host, so these are patterns to look for, not a diagnosis.

After it returns 200

Resubmit in Search Console. If Search Console still cannot read it, that is a separate failure covered in sitemap could not be fetched, and a robots.txt block is covered in blocked by robots.txt. For how core and plugin sitemaps differ, see WordPress sitemap XML.

Unverified from outside: why one particular host returns 404, since that depends on server configuration and cache layers. The tests above isolate the layer; they do not replace your host's logs.

Questions people ask

What is the default WordPress sitemap URL?

WordPress core exposes a sitemap index at /wp-sitemap.xml, introduced in version 5.5. SEO plugins that take over generate their own, such as /sitemap_index.xml, and in that case the core URL may return 404 on purpose.

Why does flushing permalinks help?

WordPress serves sitemaps through its rewrite rules. If those rules are stale or missing, the request never reaches WordPress. Saving the Permalinks screen regenerates them. A WordPress core contributor also advised enabling pretty permalinks when a sitemap plugin was deactivated.

Is a 404 on wp-sitemap.xml always a problem?

No. If an SEO plugin provides a working sitemap elsewhere and you submit that one, the core URL returning 404 is expected. The fault is a 404 on the sitemap you actually submit.

Can the Discourage search engines setting cause it?

Yes. WordPress core documentation says sitemaps are disabled when the site is set to discourage search engines from indexing.

Sources

  1. WordPress Core: New XML sitemaps functionality in WordPress 5.5, accessed 2026-11-12.
  2. WordPress documentation: Settings Reading screen, accessed 2026-11-12.
  3. Google Search Central: Build and submit a sitemap, accessed 2026-11-12.