Troubleshooting · Troubleshooting
How to Fix a Sitemap That Returns an Error in WordPress
Short answer
To fix a WordPress sitemap error, open the right sitemap URL first: /wp-sitemap.xml for core WordPress, or /sitemap_index.xml for Yoast SEO and Rank Math. Then re-save your permalinks under Settings → Permalinks, make sure only one SEO plugin builds a sitemap, and uncheck “Discourage search engines” under Settings → Reading. Finally, resubmit the sitemap in Google Search Console and watch the status change to Success.
Key takeaways
- WordPress 5.5 and later builds a sitemap at /wp-sitemap.xml with no plugin needed.
- Yoast SEO and Rank Math replace the core sitemap with their own at /sitemap_index.xml.
- Re-saving permalinks under Settings → Permalinks fixes most sitemap 404 errors.
- A ticked “Discourage search engines” box under Settings → Reading switches the core sitemap off.
- Google treats a submitted sitemap as a hint, not a promise to crawl every listed URL.
What does a sitemap error mean in WordPress?
A sitemap error means Google or your browser could not load, read, or trust the XML file that lists your site's pages.
The error shows up in two places. Your browser may show a 404 page, a blank page, or an XML parsing error at the sitemap URL.
Google Search Console may show “Couldn't fetch”, “Has errors”, or “Could not be read” in the Sitemaps report. Google's Search Console help documents the Sitemaps report, where each submitted sitemap shows a status and the errors Google found while reading it.
A sitemap error does not always mean your pages are gone from search results. It means Google cannot use that file to find them, so new and changed pages may be found late or not at all.
Which sitemap URL should you check first?
Check the URL that matches the tool that builds your sitemap, because WordPress core and SEO plugins use different addresses.
| Sitemap builder | Sitemap index URL | Notes |
|---|---|---|
| WordPress core (5.5 or later) | /wp-sitemap.xml | Built in, no plugin needed |
| Yoast SEO | /sitemap_index.xml | Replaces the core sitemap |
| Rank Math | /sitemap_index.xml | Replaces the core sitemap |
| All in One SEO | /sitemap.xml | Check the plugin settings for the exact URL |
WordPress has generated a sitemap at /wp-sitemap.xml since version 5.5, with no plugin needed, Learn WordPress explains.
Yoast SEO builds its own index at /sitemap_index.xml and switches the core sitemap off, Yoast's help page explains. Rank Math uses the same address, and its settings live under Rank Math SEO → Sitemap Settings, Rank Math's knowledge base explains.
Open both /wp-sitemap.xml and /sitemap_index.xml in a private browser window. The one that loads as XML is your live sitemap.
The other returning a 404 is normal. If the sitemap address shows your theme's 404 page instead, see how to fix a 404 error on posts for the rewrite checks that also apply here.
Why does the sitemap return a 404?
A sitemap 404 usually means WordPress has no rewrite rule for that address, or the sitemap feature is switched off.
- Stale rewrite rules after a move, a plugin switch, or an update.
- The “Discourage search engines” box is ticked under Settings → Reading.
- Two SEO plugins are active, and each one tries to own the sitemap URL.
- A leftover static file named sitemap.xml or sitemap_index.xml sits in the site root.
- A cache or firewall serves an old 404 after the real problem is fixed.
When “Discourage search engines from indexing this site” is ticked, WordPress switches the core sitemap off and the URL returns a 404, Learn WordPress explains.
A static file in the root folder beats the generated sitemap, because the server serves the real file first. Delete it over SFTP or in your host file manager, then save permalinks again.
How do you fix a sitemap 404 step by step?
Work through these steps in order, and reload the sitemap URL after each one.
- Open Settings → Reading and uncheck “Discourage search engines from indexing this site”, then save.
- Open Settings → Permalinks and click Save Changes without changing anything, which rebuilds the rewrite rules.
- Deactivate any second SEO plugin, then save permalinks again.
- Delete a leftover sitemap.xml or sitemap_index.xml file from the site root over SFTP or in your host file manager.
- Clear the page cache and CDN cache, then open the sitemap URL in a private window.
- If the sitemap still 404s, check that the sitemap module is on: Yoast SEO → Settings → Site features → XML sitemaps, or Rank Math SEO → Sitemap Settings.
Saving permalinks rebuilds the rewrite rules WordPress uses to answer the sitemap address, and that single step fixes most 404s after a move or plugin change.
Rank Math's knowledge base lists its sitemap settings under Rank Math SEO → Sitemap Settings, where you can confirm the module is on and see the sitemap index address, Rank Math's knowledge base explains.
What if Search Console says “Couldn't fetch”?
“Couldn't fetch” means Google could not download your sitemap file at all, so nothing inside it was read.
Google's Sitemaps report help lists the errors a fetch can hit, from HTTP errors such as a 404 to URLs blocked by robots.txt and files Google could not parse, Google's Search Console help explains.
Paste the sitemap URL into the URL Inspection tool and run a live test. You want “Crawl allowed?” to read Yes and “Page fetch” to read Successful before you resubmit.
If the live test passes but the Sitemaps report still shows the error, remove the old entry and submit the correct URL again. Google retries a failed sitemap for a few days and then stops, so fix the cause first and resubmit after.
A firewall or Cloudflare rule can block Googlebot while your browser loads the file fine, so check Cloudflare cache rules for WordPress if the live test fails but the URL works for you.
What if the sitemap loads but has errors?
“Has errors” means Google downloaded the file but found entries it could not use, such as bad XML or blocked URLs.
| Search Console message | What it means | Fix |
|---|---|---|
| “Sitemap could not be read” | The file is not valid XML | Open the URL, view source, and look for text before the XML declaration |
| “URL blocked by robots.txt” | A robots.txt rule blocks a listed URL | Remove the rule or remove the URL from the sitemap |
| “URL marked noindex” | A listed page tells search engines not to index it | Remove the page from the sitemap or remove the noindex tag |
| “Invalid date” | A lastmod value is not a valid date | Let the plugin rebuild the sitemap instead of editing it by hand |
A sitemap must be UTF-8 encoded, and every URL in it must be a full absolute address, Google's Search Central guide explains.
A single sitemap file can hold at most 50,000 URLs or 50MB uncompressed, and larger sites must split the list into several files under one index, Google's Search Central guide explains.
Never edit a plugin sitemap by hand. Change the setting that put the bad URL there, such as a noindex tag or a robots.txt rule, then let the plugin rebuild the file.
If the sitemap returns a 500 error instead of XML, follow how to fix a 500 internal server error before you touch the sitemap settings.
How do you fix a sitemap conflict between two SEO plugins?
Two SEO plugins fighting over the same sitemap URL is a common cause of sitemap errors after a plugin switch.
Pick one SEO plugin and fully deactivate the other, including any add-on that builds sitemaps. Then save permalinks and clear the cache.
Check your robots.txt file after the switch. It should name one sitemap in a Sitemap: line, and that line should match the plugin you kept.
The sitemaps protocol allows a sitemap index to list up to 50,000 sitemaps, so file size is rarely the cause of a conflict, the sitemaps protocol explains.
How do you confirm the sitemap is fixed?
The sitemap is fixed when the URL returns XML with a 200 status and Search Console reports Success.
- Open the sitemap URL in a private window and confirm it shows XML, not a 404 page.
- Open one child sitemap, such as post-sitemap.xml, and confirm it lists real post URLs.
- Run a live test in URL Inspection and confirm the fetch succeeds.
- Resubmit the sitemap in Search Console under Indexing → Sitemaps.
- Wait a day, then check the status and the count of discovered URLs.
Submitting a sitemap is only a hint, and Google may still choose not to crawl every listed URL, Google's Search Central guide explains.
After the fix, ask search engines to recrawl new content. How to speed up indexing with Bing covers the Bing side of the same job.
What mistakes should you avoid?
Most sitemap errors come back because of a rushed step, not a hard problem.
- Submitting the wrong sitemap URL, such as /wp-sitemap.xml when Yoast is active.
- Editing the sitemap XML by hand instead of fixing the setting that caused the bad entry.
- Leaving two SEO plugins active after a switch.
- Resubmitting to Search Console before the URL loads clean XML in a private window.
- Forgetting to clear the cache, so an old 404 keeps being served after the fix.
Frequently asked questions
Why does my sitemap return a 404 after I move my site?
A move often leaves stale rewrite rules behind. Save permalinks under Settings → Permalinks, check that only one SEO plugin is active, and confirm the sitemap module is on. Clear the cache and open the sitemap URL in a private window to confirm it loads.
Should I submit both /wp-sitemap.xml and /sitemap_index.xml to Google?
No. Submit only the sitemap your active setup builds. If Yoast SEO or Rank Math is active, submit /sitemap_index.xml. If no SEO plugin builds a sitemap, submit /wp-sitemap.xml. Submitting both creates duplicate reports and hides which file has the error.
How long does Google take to accept a fixed sitemap?
Google usually refetches a resubmitted sitemap within a day, but the status can take longer to update. If the URL Inspection live test passes, the file is fine, and the report should change to Success on the next fetch.
Can a caching plugin break my sitemap?
Yes. A cache can store a 404 or an old copy of the sitemap and keep serving it after you fix the cause. Exclude sitemap URLs from caching, purge the cache after every fix, and test the URL in a private window with a fresh query string.
Do I need a sitemap plugin if WordPress builds one already?
Not always. The core sitemap at /wp-sitemap.xml covers posts, pages, taxonomies, and authors, which is enough for many small sites. An SEO plugin adds control over which content is included, plus image sitemaps, which larger sites often need.
Sources
- Building a Sitemap for a Site Learn WordPress
- Build and Submit a Sitemap Google Search Central
- Sitemaps Report Google Search Console Help
- XML Sitemaps Yoast Help
- Configure Sitemaps Rank Math Knowledge Base
- Sitemaps XML Protocol sitemaps.org
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
