SEO

XML Sitemaps Explained: WordPress Sitemap XML Setup, What to Include and How to Submit It

XML sitemaps explained: what a sitemap does, what to include or leave out, how WordPress, Yoast and Rank Math build one, and how to submit it to Google.

XML Sitemaps Explained: WordPress Sitemap XML Setup, What to Include and How to Submit It
On this page
  1. What an XML sitemap is, and what it isn't
  2. What to include and what to leave out
  3. How WordPress creates sitemaps
  4. Keep lastmod honest
  5. Submit your sitemap to Google and Bing
  6. Reading the Sitemaps and Pages reports
  7. Common sitemap mistakes
  8. Find your WordPress sitemap XML URL
  9. When to get help
  10. FAQs
Key takeaways
  • An XML sitemap lists the URLs you want search engines to crawl; it helps Google find pages, but it does not make Google index or rank them.
  • List only canonical, indexable pages that return a 200 status, keep lastmod honest, and let one plugin generate the sitemap rather than two.
  • Submit the sitemap index once in Search Console, then use the Pages report filtered to submitted pages to see which listed URLs Google has left out and why.

An XML sitemap is a file that lists the URLs on your website you want search engines to crawl and index, usually with the date each page last changed. It helps Google discover pages, especially on a new site, a large site or pages with few internal links, but it does not force Google to index or rank anything. On WordPress the sitemap is generated for you, by WordPress itself or by an SEO plugin such as Yoast or Rank Math; your job is to keep it clean, submit it in Search Console and check what Google does with the URLs in it.

In the audit that starts my WordPress SEO services, the sitemap is one of three lists I compare, alongside what a crawler finds by following links and what Search Console reports as indexed, because a sitemap full of redirects, noindexed pages or staging URLs sends Google mixed signals about which pages matter. Below: what goes in a sitemap, how WordPress builds one, how to submit it and how to read the reports afterwards.

If Search Console already shows an error for your sitemap, start with sitemap "couldn't fetch" explained, then come back here to clean up what the sitemap lists.

Short answer: An XML sitemap lists the URLs you want search engines to crawl, with when each last changed. WordPress builds one at /wp-sitemap.xml; Yoast and Rank Math replace it with /sitemap_index.xml. Keep only indexable, canonical pages that return 200 in it, submit it under Indexing > Sitemaps in Search Console and list it in robots.txt.

What an XML sitemap is, and what it isn't

A sitemap is a plain list written in a standard format that Google, Bing and other search engines read. A minimal one looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/services/wordpress-maintenance/</loc>
    <lastmod>2026-10-01</lastmod>
  </url>
  <url>
    <loc>https://example.com/blog/website-launch-checklist/</loc>
    <lastmod>2026-09-18</lastmod>
  </url>
</urlset>
  • loc is the full URL of the page, exactly as you want it indexed: https, the right www or non-www version, and the trailing slash your site uses.
  • lastmod is when the page's content last changed meaningfully. Google uses it when it proves accurate over time.
  • changefreq and priority still appear in many sitemaps, but Google has said it ignores both, so don't spend time tuning them.

Larger sites split their URLs into several sitemaps, such as one for posts, one for pages and one for products, and list those in a sitemap index. Each sitemap file can hold up to 50,000 URLs or 50 MB uncompressed, so the split is normally about organisation rather than size.

What a sitemap doesn't do: it doesn't override a noindex tag or a robots.txt block, it doesn't replace internal links, and it doesn't tell Google a page is good enough to index. It is a discovery aid, nothing more.

What to include and what to leave out

The rule is simple: list only pages you want to appear in Google, at the exact URL you want indexed, that load normally. Pages also need internal links; see fixing orphan pages.

IncludeLeave outWhy leave it out
Homepage, service and industry pagesPages set to noindexYou'd be asking Google to crawl a page and telling it not to index it
Blog posts and case studiesRedirected URLsThe sitemap should list the final address, not the old one
Products and useful product categories404 and deleted pagesErrors in a sitemap suggest it isn't maintained
Location pages with real contentDuplicate or parameter URLs, such as filtered or sorted shop pagesOnly the canonical version belongs; see canonical tags explained
Category archives that help visitorsThin tag archives, attachment pages, author archives on a one-author siteLow-value pages dilute the list
Downloadable PDFs you want foundCart, checkout, my-account and thank-you pagesThey are useless as search results

Whether category and tag archives belong depends on whether they are useful pages in their own right; SEO for category and tag pages helps you decide.

How WordPress creates sitemaps

Since WordPress 5.5, WordPress has generated a basic sitemap of its own. SEO plugins replace it with a more configurable one. Use one system only: when you turn on a plugin's sitemap, it normally switches off the WordPress one.

Generated byUsual addressWhere to control it
WordPress corehttps://example.com/wp-sitemap.xmlNo settings screen; changes need code or a plugin
Yoast SEOhttps://example.com/sitemap_index.xmlYoast SEO > Settings: the XML sitemaps switch under Site features, plus the "show in search results" switches for each content type and taxonomy
Rank Mathhttps://example.com/sitemap_index.xmlRank Math SEO > Sitemap Settings, with an "Include in Sitemap" switch for each post type and taxonomy
All in One SEOhttps://example.com/sitemap.xmlAll in One SEO > Sitemaps
XML sitemap WordPress: Yoast SEO Settings, Site features, XML sitemaps switch on
Step 1: In Yoast SEO, Settings, Site features, keep XML sitemaps on and open the sitemap link.

Menu names move around between plugin versions, so treat these as a guide at the time of writing. In Yoast and Rank Math, setting a single post or page to noindex (in the Advanced tab of the plugin's panel in the editor) also removes it from the sitemap, which is the cleanest way to drop one URL.

Tidying a WordPress sitemap

  1. Open your sitemap index in a browser and click into each child sitemap. Note anything you wouldn't want as a search result.
  2. Switch off post types and taxonomies that produce thin pages, typically tags, media attachment pages and, on a site with one author, author archives.
  3. Noindex individual pages that shouldn't be found, such as thank-you pages and internal landing pages built only for ads.
  4. Check one URL from each child sitemap: it should load with a 200 status, not redirect, and its canonical tag should point to itself.

Without an SEO plugin, the core sitemap can be trimmed with a filter in a small custom plugin or your child theme's functions.php. This one removes the users (author) sitemap:

add_filter( 'wp_sitemaps_add_provider', function( $provider, $name ) {
  return ( 'users' === $name ) ? false : $provider;
}, 10, 2 );

One thing worth knowing: if https://example.com/wp-sitemap.xml shows a 404 and you have no SEO plugin, check Settings > Reading. WordPress turns its sitemap off while "Discourage search engines from indexing this site" is ticked.

Keep lastmod honest

Google has said it uses lastmod only when it is consistently and verifiably accurate. If every URL shows today's date after every small change, or after a bulk edit re-saves every post, Google learns to ignore the field. Then it has no hint about which pages genuinely changed.

  • Let lastmod change when the content changes: new sections, corrected information, updated prices or products.
  • Avoid tools or habits that re-save every post at once without real edits.
  • Don't fake freshness by changing dates without changing the page.

This site is custom-coded rather than built on WordPress, and its build script now changes a page's lastmod only when that page's content actually changes, for exactly this reason. Google also retired its old sitemap "ping" address in 2023, so an accurate lastmod in a sitemap Google already knows is now the main way to signal an update.

Submit your sitemap to Google and Bing

  1. In Google Search Console, open Indexing > Sitemaps.
  2. Under "Add a new sitemap", enter the sitemap index address, such as sitemap_index.xml, and click Submit. Submit the index only; Google reads the child sitemaps from it.
  3. Add a Sitemap line with the full sitemap URL to your robots.txt, so any crawler can find it; see robots.txt explained.
  4. In Bing Webmaster Tools, submit the same sitemap, or import your site from Search Console, which brings the sitemap with it.
Submit XML sitemap: Google Search Console Sitemaps, Add a new sitemap field with Submit
Step 2: In Search Console, Sitemaps, enter sitemap_index.xml and click Submit.

You don't need to resubmit after every new post. Google rechecks known sitemaps on its own schedule. Resubmitting after a migration or a big restructure does no harm.

Reading the Sitemaps and Pages reports

The Sitemaps report shows a status for each sitemap (Success, Has errors or Couldn't fetch), when Google last read it and how many URLs it discovered. Success only means Google could read the file. It says nothing about indexing.

For that, open Indexing > Pages and change the filter at the top from "All known pages" to "All submitted pages", or to one specific sitemap. You now see which listed URLs are indexed and, for the rest, the reason. Patterns to look for:

  • Excluded by noindex, Page with redirect or Not found (404): the sitemap lists URLs it shouldn't. Fix the sitemap settings.
  • Alternate page with proper canonical tag: the sitemap lists duplicates instead of the canonical version.
  • Discovered or Crawled, currently not indexed: the URLs are fine to list, but Google hasn't chosen to index them yet. That is a quality, linking or patience problem, not a sitemap problem; page indexing errors explained covers what each status means.

Common sitemap mistakes

  • Two sitemaps from two plugins, such as an SEO plugin and a separate sitemap plugin, listing slightly different URLs.
  • Old URLs after a move: http addresses, a staging domain or the previous domain still listed after a migration or redesign.
  • The sitemap blocked by a robots.txt rule, a security plugin or a firewall setting that challenges bots.
  • A stale cached copy served by a caching plugin or CDN, so new pages never appear in it.
  • Treating submission as indexing. A sitemap gets URLs discovered; internal links, quality and time get them indexed. How to get a new site indexed faster covers what actually speeds that up.

Get help when Search Console says the sitemap "Couldn't fetch", discovers far fewer pages than you have, or the sitemap lists noindexed, redirected or thin URLs. The fix is usually one sitemap source listing only the pages you want indexed.

Find your WordPress sitemap XML URL

What builds itUsual sitemap URLWhere to switch it on or off
WordPress core/wp-sitemap.xmlOn by default; off if Settings > Reading blocks search engines
Yoast SEO/sitemap_index.xmlYoast SEO > Settings > Site features > XML sitemaps
Rank Math/sitemap_index.xmlRank Math > Dashboard, Sitemap module, then Sitemap Settings
All in One SEO/sitemap.xmlAll in One SEO > Sitemaps

If the URL returns a 404, re-save Settings > Permalinks, purge your cache and check that only one plugin is generating a sitemap. Then submit the working URL in Search Console.

When to get help

Get help when the sitemap lists noindexed, redirected or thin pages, when two plugins produce two sitemaps, or when Search Console shows sitemap errors. WordPress SEO services covers this kind of work, with a written scope before anything starts. You can also send the details through the contact form.

On Shopify the sitemap is created for you; the Search Console for Shopify tutorial shows where to submit it.

Your robots.txt should point to the sitemap; the free robots.txt generator adds the Sitemap line for you.

FAQs

What is an XML sitemap in SEO?

It is a file listing the URLs you want search engines to crawl, with optional last-modified dates. It helps Google and Bing discover your pages efficiently, but it doesn't guarantee indexing or improve rankings by itself.

Where is my WordPress sitemap?

With Yoast or Rank Math it is usually at /sitemap_index.xml on your domain, with All in One SEO usually /sitemap.xml, and without an SEO plugin WordPress provides /wp-sitemap.xml. Your SEO plugin's sitemap settings also show a link to it.

Does submitting a sitemap get my pages indexed?

No. It makes sure Google knows the URLs exist. Google then decides whether to crawl and index each one based on quality, duplication, internal links and how much it trusts the site.

How often should I resubmit my sitemap?

Once is enough. Google rechecks submitted sitemaps by itself, and new posts appear automatically because WordPress plugins update the sitemap as you publish. Resubmit only after a migration or a major restructure if you want to prompt a fresh read.

Do I also need an HTML sitemap?

It is optional. An HTML sitemap is a normal page of links for visitors, and it can help on large sites, but good navigation and internal links do the same job. It doesn't replace the XML sitemap.

Why is my WordPress sitemap XML showing a 404?

Usually the permalink rules need refreshing, a cache is serving an old response, or the SEO plugin's sitemap feature is switched off. Re-save Settings > Permalinks, clear caches, confirm the feature is enabled and test the URL in a private window.

Should I use the WordPress core sitemap or my SEO plugin's?

Use one. If you run Yoast, Rank Math or All in One SEO, their sitemap replaces the core one and gives more control over what is excluded. Without an SEO plugin, the core sitemap at /wp-sitemap.xml is fine for most small sites.

Need help with your website?

I'm a freelance WordPress developer building fast, SEO-friendly websites since 2020. Tell me what you need and I'll reply with a plan and a fixed quote, usually within 24 hours.

Found this useful? Share it:
Contact

Let's build your next website

Available for freelance projects, agency white-label work and long-term maintenance. Feel free to pass this along to your team or company.

I reply within 24 hours, usually the same day. Your details are emailed to me, then WhatsApp opens so we can chat right away.

Chat now