Skip to content Skip to navigation

My XML sitemap doesn’t work or return errors

Start here: run the built-in Sitemap health check

Since SEOPress 10, you don’t have to diagnose sitemap problems by hand. SEOPress ships a free Sitemap health check that runs the most common checks for you in a few seconds.

Where to find it: go to SEO, XML / HTML Sitemap, General, then click Test my sitemap button.

The tool runs a quick diagnostic and returns one of three results:

  • ✅ Your XML sitemap looks healthy.
  • ⚠️ Your XML sitemap works, but some points need attention.
  • ❌ We found issues with your XML sitemap.

Each check is listed with a clear status, an explanation, and when possible a one-click fix (for example, a Flush permalinks button when the sitemap returns a 404).

What it checks automatically:

  • The XML sitemap feature is enabled
  • The sitemap is reachable (HTTP 200, no 404 / 5xx / 401 / 403)
  • It is served as XML, not HTML (cache/CDN interference)
  • The XML is valid (no BOM, no blank line before <?xml)
  • The root element is a real sitemap (<sitemapindex> or <urlset>)
  • The sitemap is not empty and stays under the 50,000-URL limit
  • The XSL stylesheet loads
  • Sub-sitemaps respond (posts, taxonomies, authors, video, news)
  • Permalinks are set to a pretty structure
  • Search engines are not discouraged (Settings, Reading)
  • robots.txt advertises the sitemap and doesn’t block it
  • No conflicting SEO plugin or caching plugin is interfering
  • NGINX rewrite rules note for non-Apache servers

If the health check flags an issue, the matching section below explains it in detail and how to fix it.

💡 SEOPress PRO: with PRO, this diagnostic can run automatically and send you an email or Slack alert as soon as your sitemap breaks, through the SEO Alerts module, so you catch problems before search engines do.

Do not cache your XML sitemaps

If you can’t see your XML sitemap or you get this error from Google Search Console “Your file appears to be an HTML page“:

My XML sitemap returns a 404 error

Although if we do this automatically, try to flush your permalinks from Settings, Permalinks if you encounter a 404 error when accessing your XML sitemaps.

Read our guide if you still see a 404 error

NGINX user?

You must add several rewrite rules to your NGINX configuration file. Contact your webhost to take of this.

Google Search Console returns errors

Generating an XML sitemap for your images is a daunting task, especially if you are using shortcodes to display your images.

Google couldn’t fetch the sitemap

This dedicated guide can help you with this error.

My XML sitemap is blank

XSL issue

There may be a problem with the stylesheet associated with the XML sitemap. It may not be loading or has been altered via your theme or a third-party plugin.

Generally, by looking at the source code of the stylesheet, we can quickly find the culprit.

URL of the stylesheet: https://example.com/sitemaps_xsl.xsl

WP Debug

Or, if your index sitemap and / or sub-sitemaps are blank, including your source code, you have to enable the WP Debug feature to get the error. Once the debug is enabled, load again your XML sitemap. The error will appear in your debug.log file.

A URL is missing in my sitemap

Make sure you don’t have set your URL as noindex.

If you have set a custom canonical tag different from your permalink, it will be automatically excluded from the sitemap too to follow Google guidelines.

The source code of my sitemaps shows “extra code”

Shortcodes are disabled by default since version 9.0 of SEOPress.

If you see some PHP or JS scripts related to a third party plugin, you can try to disable shortcode execution by adding this snippet to your functions.php file of your child theme (you can also use a must use plugin if you prefer or if you don’t have this file available, eg Oxygen builder):

My sitemap is too slow

Try to disable Image sitemaps option from the General settings.

XML declaration allowed only at the start of the document

If you open the source code of you XML sitemaps, the first line is probably empty hence the issue.

This error is generally a bad opening / closing of the <?php tag.

Check your header.php, functions.php files of your theme, and also wp-config.php file.

Timeout error when loading the XML index sitemaps

Try to limit the index query with this snippet to 10K posts (copy-paste this to your functions.php file of your child theme/theme/mu-plugins):

My XML sitemap still doesn’t work

Open a support ticket from your customer area. If you’re a Free user, create a topic on w.org forum.