Blog / WordPress /

XML sitemaps on WordPress: what to include and what to leave out

An XML sitemap is a list of the pages on your site that you’d like search engines to know about. That’s it. It doesn’t guarantee anything gets indexed, and it doesn’t boost rankings.

What it does do is tell Google which URLs you think matter. So it’s worth making sure the list is right.

On WordPress, sitemaps are generated automatically, which is great until you open one and find 400 tag pages, every image attachment and a “Test page – do not publish” from 2019.

Where your sitemap is

It depends on what’s generating it:

  • WordPress’s built-in sitemap (since version 5.5): yoursite.com/wp-sitemap.xml
  • Yoast SEO or Rank Math: yoursite.com/sitemap_index.xml. These plugins switch off the built-in one and replace it.
  • Other SEO plugins: usually somewhere similar. Check the plugin’s settings.

If two of these are working at once, you’ve got two sitemaps listing overlapping pages. Pick one. Usually the SEO plugin’s, since it gives you more control.

A sitemap “index” is just a sitemap of sitemaps: one for posts, one for pages, one for categories and so on. That’s normal.

What should be in it

Pages you want people to find through search:

  • your main pages (home, services, about, contact)
  • blog posts
  • product pages, if you sell things
  • category pages that are genuinely useful: ones with a description and a decent number of posts

What shouldn’t be in it

Anything set to noindex

If a page is set to noindex, it shouldn’t be in the sitemap. Listing it sends Google mixed messages: “here’s an important page” and “don’t index this page”. Good SEO plugins handle this automatically, but check anything you’ve changed manually.

Redirected or deleted URLs

The sitemap should only list URLs that return a normal page (status 200). If a URL redirects, list where it redirects to. Old URLs in the sitemap are a sign it isn’t being kept up to date, or something’s caching an old version.

Tag archives (usually)

On most sites, tag pages are thin: a heading and a list of a couple of posts. If you’ve decided to noindex them (see the WordPress SEO checks I run first), take them out of the sitemap too.

Media attachment pages

WordPress can create a separate page for every image you upload. These pages have almost no content. Most SEO plugins let you redirect attachment pages to the file itself, and they shouldn’t appear in your sitemap.

Author archives on a one-author site

If you’re the only author, your author archive duplicates your blog page. Turn it off or noindex it, and leave it out.

Utility pages

Thank-you pages, cart, checkout, account pages, login. These aren’t for search.

Things you can safely ignore

  • priority and changefreq: Google has said it ignores these. Don’t spend time on them.
  • lastmod: this is used, if it’s accurate. It tells Google when a page last changed meaningfully. WordPress plugins fill it in from the post’s modified date, which works well as long as you’re not updating dates for trivial changes.

Limits

One sitemap file can list up to 50,000 URLs and be up to 50 MB uncompressed. WordPress plugins split sitemaps into several files long before that, so you’ll rarely hit it.

How to check yours

  1. Open your sitemap in a browser and click through each sub-sitemap.
  2. Look for anything from the “shouldn’t be in it” list above.
  3. Spot-check a few URLs. Do they load? Are they pages you’d want someone to land on from Google?
  4. Compare the total with what you expect. 80 posts and 15 pages shouldn’t produce a sitemap with 900 URLs.
  5. In Search Console, open Sitemaps and check the status is “Success”. Then check Indexing → Pages to see how many sitemap URLs are actually indexed. You can filter that report to only show sitemap URLs.

That last check is useful. If you’ve listed 200 pages and Google’s indexed 60, the question is why. The reasons in the Pages report usually tell you. If you haven’t set up Search Console yet, start with how to set it up properly.

Fixing it in an SEO plugin

Most of the cleanup happens in your SEO plugin’s settings, not in the sitemap itself:

  • set tags, author archives, date archives and attachment pages to noindex (or disable them), and they’ll drop out of the sitemap
  • for individual pages, set noindex in the page’s SEO settings
  • exclude specific post types, like portfolios you don’t want indexed, from the sitemap settings

Then resubmit the sitemap in Search Console. Not strictly necessary, but it nudges Google to look again.

FAQ

Do I need a sitemap at all?

Small, well-linked sites can be found without one. But it’s free, automatic on WordPress and helps Google find new content faster, so yes.

Should images be in the sitemap?

Some plugins add image information to post sitemaps, which is fine. Separate attachment pages shouldn’t be listed.

How often should I resubmit it?

You don’t need to. Google re-reads submitted sitemaps on its own. Resubmit after big changes.

Open your sitemap right now and count the sub-sitemaps. If there’s one you didn’t expect, that’s your first fix.