Sitemap Not Working? How to Find the Problem and Fix It
SEO

Sitemap Not Working? How to Find the Problem and Fix It

A sitemap is an XML file that lists the URLs you want Google to know about. If Search Console shows an error, if the sitemap URL returns a 404, or if the pages listed in it do not get indexed, the problem is almost always in one of a few fixed places: the URL you submitted, the plugin that generates the file, a setting that blocks access, or the content of the file itself. This guide covers how to fix a WordPress sitemap that is not working.

First, a reminder: according to Google, submitting a sitemap is only a hint. It does not guarantee that Google will download the file or use it for crawling, and certainly not that every page in it will be indexed. So when something does not work, go through the checks below in order, from the simplest to the most involved. If you also work on your site’s internal structure, breadcrumbs for SEO are a useful companion, because they help Google understand the hierarchy between pages.

Step 1: Where is the file at all?

Since version 5.5, WordPress generates an XML sitemap on its own, without a plugin, at /wp-sitemap.xml. It is an index file that points to sub-files by content type: pages, posts, categories, author pages and more. SEO plugins generate their own file. In Yoast SEO and Rank Math the address is /sitemap_index.xml, and Yoast disables the built-in WordPress file.

By default, the built-in WordPress file includes all public content types and taxonomies, author pages and the home page. If you have a custom post type that is set to public, it will appear in the list even if you did not intend that, so it is worth checking.

The first check is to open both addresses in your browser, on your own domain. One of them should show a list of sub-files. If both return a 404, move on to the next step.

If one of them works, decide which file is the official one and submit only that one to Search Console. If you have an SEO plugin that generates a sitemap, submit its file.

Step 2: The sitemap returns a 404 or a blank page

There are several documented reasons why the file does not load:

  • The “Discourage search engines from indexing this site” setting is checked. The box is under Settings > Reading. According to the WordPress documentation, when it is checked the built-in sitemap is turned off and its URL returns a 404, and a noindex tag is added to every page. To fix it, uncheck the box and save.
  • Rewrite rules are out of date. Rank Math’s documentation recommends that when the URL returns a 404, you go to Settings > Permalinks and click Save Changes without changing anything. This refreshes the WordPress rewrite rules.
  • A caching plugin. The same documentation recommends excluding the sitemap URL from your caching plugin, because a file cached during a failure keeps being served broken even after the failure is fixed.
  • A physical file on the server. If an old file named sitemap.xml or sitemap_index.xml sits in your site’s root folder, it can conflict with the file your plugin generates. Yoast recommends deleting such files over FTP and turning off other sitemap plugins.
  • A completely blank page. According to Rank Math, when the page source is empty, it is usually a conflict with another plugin or with your theme. To find the culprit, disable plugins one at a time in a staging environment.

Step 3: Search Console shows “Couldn’t fetch”

In the Sitemaps report, every file you submit gets a status: Success, Has errors or Couldn’t fetch. Couldn’t fetch means Google could not download the file. Google lists several possible reasons:

  • The file is blocked in robots.txt.
  • There is an unresolved manual action on the site.
  • The submitted URL is wrong and returns a 404.
  • The server was unavailable.
  • Low crawl demand for the file.

First, check that the URL you submitted matches the real one, including https, with or without www, and without a typo. Then run the URL Inspection tool on the sitemap URL, as Google recommends doing before submitting, and see whether Googlebot can reach it.

If the URL is correct and the file opens in your browser but Google still cannot reach it, check robots.txt, and then everything that sits between Google and your server: a security plugin, your host’s firewall, or Cloudflare security settings if you use it. What you are looking for is a rule that blocks bots or the path of the file.

Step 4: The file loads but contains errors

When the status is Has errors, Google managed to download the file but found one or more errors in it. According to Google, URLs that were read without errors still go into the crawl queue, so this is not an all-or-nothing situation. Clicking the file in the Sitemaps report shows the error details.

One possible reason is size. According to Google’s documentation, a single file is limited to 50,000 URLs or 50MB uncompressed. A larger site splits the list into several files and submits one index file that points to them. WordPress does this automatically, and each of its sub-files is limited to 2,000 URLs by default.

There is also a rarer cause: the built-in WordPress file requires the SimpleXML PHP extension, and without it the URL returns a 501 code. If that is your case, contact your hosting provider.

Step 5: Two files competing with each other

Sometimes two plugins are installed and each generates a sitemap, or both the WordPress file and the plugin file were submitted to Search Console. According to Rank Math support, having both files at the same time mostly creates confusion in the reports, not an SEO problem. They note that Google shows only the source from which it first discovered a URL.

To clean this up, keep one SEO plugin, submit only its file, and remove old files that are no longer in use from the Sitemaps report. If you want to turn off the built-in WordPress sitemap completely, Rank Math support suggests adding the following line to the functions.php file of your child theme:

add_filter( 'wp_sitemaps_enabled', '__return_false' );

Step 6: The file is fine but the pages are not indexed

This is the most frustrating situation, and usually the problem is no longer in the file. Go to the Page indexing report in Search Console, filter by the file you submitted, and read the reason Google gives for each group of pages.

  • A page marked noindex will not be indexed, and neither will a URL that redirects to another URL (Page with redirect). Yoast automatically excludes noindex pages from its file, so if you see such URLs in the list, check where they come from. And if there are many such URLs in your sitemap, you may also have broken links on the site itself, which are worth finding and fixing separately.
  • If the reason is “Crawled – currently not indexed” or “Discovered – currently not indexed”, the problem is usually in the page itself or in the internal links pointing to it. I covered this in my article why my website does not show up on Google.

Google also states explicitly that it ignores the <priority> and <changefreq> fields, and uses <lastmod> only when it is consistently accurate. So there is no point in changing priorities in the file to push a page.

Step 7: Submit it and add it to robots.txt

There are two ways to tell Google about the file, and you can use both:

  1. In the Sitemaps report in Search Console: paste the URL into the “Add a new sitemap” field and click Submit.
  2. In the robots.txt file: add a Sitemap line with a full address, including the protocol and domain. You can add several such lines, and Google, Bing and other major search engines support them.
Sitemap: https://www.example.com/sitemap_index.xml

Before submitting in the report, Google recommends making sure the file is accessible, for example with URL Inspection. After submitting, come back to the report later and check the sitemap’s status. Success means the file was read without errors, and any other status sends you back to steps 3 and 4.

When to stop and call an expert

If you went through all the steps and the report still shows Couldn’t fetch, if you are not sure which server or firewall rule is blocking access, or if the file broke because of a plugin conflict you cannot track down, this is the point to stop. Changes to a firewall, server rules or theme code can take a site down, and whoever touches them should also know how to roll back. And if your pages are already indexed but not moving up, the problem is no longer technical, and I wrote about that in how to improve your Google ranking fast. The next question once pages get indexed is how much traffic they actually bring, and I wrote a separate guide on that: website traffic and how to read the number correctly.

Google’s official guide to building and submitting the file is on Google Search Central. And if you tried on your own and it did not work, talk to me and I will take care of it.

Frequently asked questions

Does every website need a sitemap?

Not necessarily. According to Google, a small site whose internal links lead to all the important pages from the home page can manage without one. In WordPress the file exists anyway, so there is no reason to give it up.

What is the XML sitemap URL in WordPress?

The built-in WordPress file is at /wp-sitemap.xml. In Yoast SEO and Rank Math the address is /sitemap_index.xml.

What is the difference between an XML sitemap and a regular sitemap page?

An XML file is meant for search engines and is submitted in Search Console. An HTML page with a list of links is meant for visitors. When people talk about a sitemap in the context of Google, they mean the XML file.

I submitted a sitemap. Why are the pages still not on Google?

Because submitting is a hint, not a commitment. Google decides on its own whether to crawl and index each page. In the Page indexing report you will find the reason for every page that was not indexed.

Do I need to resubmit after every new post?

No. WordPress and SEO plugins update the file automatically when new content is published. Submitting it once is enough.

How many URLs can go in one file?

According to Google, up to 50,000 URLs or 50MB uncompressed per file. Beyond that, you split it into several files and submit one index file. The built-in WordPress file splits automatically, with up to 2,000 URLs per sub-file by default.

What do I do when “Couldn’t fetch” appears?

Check that the submitted URL is correct and opens in your browser, that it is not blocked in robots.txt, that there is no manual action on the site, and that the server or firewall is not blocking Googlebot.

Have a project worth talking about?

The call is free, with no commitment 😊