WordPress Sitemap Not Working? A Fix Tree for 404s and Errors
When a WordPress sitemap is not working, the cause is almost always one of five things: you are opening the wrong sitemap URL, two sitemap generators are fighting, rewrite rules need a refresh, a cache or security layer is serving the wrong response, or the site is set to discourage search engines. This guide gives you a fix tree you can walk in order, from the 30-second checks to the server-level ones, plus what each Search Console sitemap error actually means.

First: which sitemap should your site have?
Half of "sitemap not working" reports are someone opening /sitemap.xml on a site whose sitemap lives somewhere else. Each generator uses its own address:
| Generator | Usual sitemap URL | Notes |
|---|---|---|
| WordPress core (5.5 and later) | /wp-sitemap.xml | Built in; covers public post types, taxonomies, authors and the home page |
| Yoast SEO | /sitemap_index.xml | Turned on under Yoast SEO → Settings → Site features |
| Rank Math | /sitemap_index.xml | Sitemap module must be enabled |
| Other sitemap plugins or a static file | Often /sitemap.xml | A physical file in the web root overrides everything |
The core sitemap index and its behavior are described in the WordPress team's announcement of sitemaps in WordPress 5.5. Yoast's own sitemap help page warns that a sitemap at /sitemap.xml is not one Yoast generates, so checking that address tells you nothing about Yoast.
Quick test: open yoursite.com/robots.txt. WordPress core and most SEO plugins add a Sitemap: line there pointing to the sitemap they actually serve. Open that URL, not a guessed one.
The fix tree
Walk these in order. Stop at the first step that fixes it, then jump to "Confirm the fix" at the end.
1. Is the site hidden from search engines?
Go to Settings → Reading and look at "Search engine visibility." If "Discourage search engines from indexing this site" is ticked, the WordPress announcement says core sitemaps are disabled. This box is often left on after a staging copy goes live. Untick it, save, and test again.
2. Flush the rewrite rules
Sitemaps are virtual URLs: WordPress answers them through rewrite rules, not files on disk. If those rules are stale (after a migration, a plugin switch or a permalink change), you get a 404.
- Go to Settings → Permalinks.
- Do not change anything. Click "Save Changes."
- Reload the sitemap URL in a private window.
This one step fixes a large share of sitemap 404s. If you use "Plain" permalinks (?p=123), switch to any pretty structure; the WordPress announcement's author recommends making sure pretty permalinks are enabled when troubleshooting.
3. Remove the conflict between generators
Run exactly one sitemap generator. Typical conflicts:
- Two SEO plugins active (for example, Yoast and Rank Math after a switch). Deactivate the one you are not using.
- An SEO plugin plus a dedicated sitemap plugin. Pick one.
- A leftover physical
sitemap.xmlin the web root from an old plugin or a manual upload. Yoast's help page tells users to remove physical sitemap files over FTP before enabling its sitemaps. The same logic applies to every generator. - Core sitemap disabled by code. A theme or snippet may use the
wp_sitemaps_enabledfilter to turn core sitemaps off. That is fine if a plugin replaces them, but not if nothing does.
After removing a generator, flush permalinks again (step 2).
4. Bypass caching and optimization plugins
Page caches, minifiers and CDNs sometimes store an old 404 or an HTML error page for the sitemap URL, or "optimize" the XML into something invalid.
- Purge the plugin cache and, if you use one, the CDN cache.
- Exclude sitemap URLs (
wp-sitemap*,sitemap*.xml) from page caching and HTML minification. - Test with
yoursite.com/wp-sitemap.xml?nocache=1to see whether a fresh copy loads.
Our guide to fixing a slow WordPress site covers how to set cache exclusions without losing the speed benefit.
5. Check security plugins and the firewall
Security plugins and host firewalls can block bots by user agent or rate. If your browser loads the sitemap but Search Console says "Couldn't fetch," something may be blocking Googlebot specifically. Look in the security plugin's log for blocked requests to the sitemap URL, and make sure verified search engine crawlers are allowed.
6. Look for PHP errors and stray whitespace
A blank page or "XML declaration allowed only at the start of the document" error usually means something printed output before the XML. Common culprits are a blank line before <?php in functions.php or a plugin throwing a warning. Google's sitemap report lists "Leading whitespace" as a warning it can still process, but PHP warnings inside the XML will break parsing. Turn on WP_DEBUG_LOG, load the sitemap, and read wp-content/debug.log.
7. Server-level rewrites (Apache vs Nginx)
If permalinks flush but sitemap URLs still 404 while normal pages work, the server is not passing those URLs to WordPress. On Apache, check that .htaccess contains the standard WordPress block and that the host allows overrides. On Nginx, .htaccess is ignored entirely; the site config needs a try_files rule that hands unknown URLs to index.php, which managed hosts usually set for you. If you cannot edit server config, ask your host.
What Search Console sitemap errors mean
Google's Sitemaps report help lists every status. These are the ones WordPress sites hit most:
| Search Console says | What it means | Likely WordPress cause |
|---|---|---|
| Couldn't fetch | Google could not retrieve the file | Wrong URL submitted, 404, firewall block, or a temporary server error |
| Blocked by robots.txt | robots.txt disallows the sitemap | A Disallow rule written by hand or by a plugin |
| Parsing error / Unsupported format | Google could not read the XML | HTML error page served instead of XML, PHP warnings, minification |
| Path mismatch: missing www / includes www | Sitemap host and listed URLs differ | Settings → General uses a different host than the one you submitted |
| URL not allowed | Listed URLs are on another domain or higher in the path | Leftover staging or old-domain URLs after a migration |
| Nested sitemap indexes | An index lists another index | You submitted a plugin index that links to the core index, or the reverse |
| Empty sitemap | No URLs in the file | Post type excluded in plugin settings, or no published content of that type |
| Sitemap contains URLs blocked by robots.txt | Some listed URLs are disallowed | Sitemap includes sections you blocked; fix one or the other |
The same help page says a "Temporary error" usually resolves on its own without resubmitting.
Limits and rules worth knowing
From Google's guide on building a sitemap:
- One sitemap file can hold up to 50,000 URLs or 50MB uncompressed; larger sites split it and use an index.
- URLs must be absolute and the file must be UTF-8.
- List only canonical URLs you want in search.
- Google uses
lastmodonly when it is consistently accurate and ignorespriorityandchangefreq. - Submitting a sitemap is a hint, not a guarantee that every URL is crawled.
WordPress core splits its own sitemaps at 2,000 entries each by default, per the 5.5 announcement, so a small blog's core sitemap is usually an index with a few short child files. That is normal, not an error.
Worked example (illustrative)
An illustrative case, not a real site: a blog moved from Yoast to Rank Math. Search Console shows "Couldn't fetch" for /sitemap_index.xml, and the browser shows a 404. Walking the tree:
- Search engine visibility: off, fine.
- Flush permalinks: still 404.
- Generators: Yoast is deactivated but a sitemap plugin from years ago is still active and has a physical
sitemap.xmlin the root. Deactivate it, delete the file, enable Rank Math's sitemap module, flush permalinks again. - The index loads, but a CDN still serves the cached 404 to some visitors. Purge the CDN and exclude sitemap URLs from caching.
Result: one sitemap, one URL, one Sitemap: line in robots.txt, resubmitted in Search Console.
Confirm the fix
- Open the sitemap in a private window. You should see XML (browsers may style it as a table), not your theme's 404 page.
- Open
robots.txtand confirm theSitemap:line points to that same URL. - In Search Console, remove sitemaps you no longer serve and submit the current one.
- Spot-check a few URLs from the sitemap in URL Inspection.
- Optional: ping faster discovery with IndexNow for Bing and Yandex; see our IndexNow for WordPress guide.
If the sitemap loads but pages still are not indexed, the sitemap was not the bottleneck. Read Discovered, currently not indexed for the next layer.
Keep it from breaking again
- After any SEO plugin switch, repeat steps 2 and 3: flush permalinks and confirm only one generator is active. Our Rank Math vs Yoast comparison lists what each plugin takes over when you activate it.
- After a migration or domain change, check Settings → General, then reopen the sitemap and look at the host in the listed URLs.
- When adding a cache or security plugin, load the sitemap in a private window the same day.
- Once a month, glance at the Sitemaps report in Search Console; a status change there is often the first sign of a broken rewrite or firewall rule.
- On a new blog, set the sitemap up as part of the initial checklist in our WordPress SEO setup guide so it is right from day one.
What to do next
A working sitemap gets your pages found; it does not get anyone talking about them. The Satelo WordPress plugin connects your site to a small public-beta network where similar sites publish articles about each other in a circle, with one-click login and auto-publishing. Every exchange link is marked rel="sponsored", and the plugin is free.
FAQ
What is the default WordPress sitemap URL?
Since WordPress 5.5, core serves a sitemap index at /wp-sitemap.xml. SEO plugins like Yoast and Rank Math replace it with their own, usually at /sitemap_index.xml. Check the Sitemap line in your robots.txt to see which one your site uses.
Why does my WordPress sitemap show a 404?
Most often the rewrite rules are stale. Go to Settings, Permalinks and click Save Changes without editing anything. If that does not help, check for conflicting sitemap plugins, a leftover physical sitemap.xml file, or caching.
Why is my WordPress sitemap blank?
A blank page usually means a PHP error or output before the XML declaration. Enable WP_DEBUG_LOG, reload the sitemap, and check wp-content/debug.log.
Why does Search Console say Couldn't fetch for my sitemap?
Google could not retrieve the file. Check that you submitted the exact URL your site serves, that it loads in a private window, and that a firewall or security plugin is not blocking Googlebot.
Does Discourage search engines disable the sitemap?
Yes. The WordPress 5.5 announcement says core sitemaps are disabled when the site visibility setting discourages search engines.
Should I use the core sitemap or a plugin sitemap?
Either works. What matters is running only one generator, keeping a single Sitemap line in robots.txt, and submitting that URL in Search Console.
Read next




Check your site's Quality Score
Free, no sign-up: a 0–100 score from mostly open data. Then add your site to Satelo and get partner articles from sites of your level.
Enter a domain like example.com
Add my site