Skip to content

WordPressPart of: XML sitemaps

WordPress sitemap: core, Yoast SEO or Rank Math, and which to keep

Where your WordPress sitemap lives, how the core wp-sitemap.xml differs from the Yoast SEO and Rank Math sitemaps, which one to keep, what to leave out of it and how to fix a sitemap that answers 404.

getReport teamUpdated 26 Sept 202611 min read

Every WordPress site has a sitemap: WordPress core publishes one at /wp-sitemap.xml, and when Yoast SEO or Rank Math is active, the plugin switches core's off and publishes its own at /sitemap_index.xml. You need exactly one of them. This guide shows how to find yours, how the core and plugin sitemaps differ, which to keep, what to leave out and how to fix the usual errors. For how sitemaps work in general, see the XML sitemap guide.

Quick answer

  • No SEO plugin: your sitemap is https://yourdomain/wp-sitemap.xml, built by core since WordPress 5.5.
  • Yoast SEO or Rank Math: it is https://yourdomain/sitemap_index.xml, and the core sitemap is switched off.
  • Keep one sitemap from one source. Two SEO plugins, or a plugin plus an old uploaded sitemap.xml, means two lists that disagree.
  • Leave out tag archives you do not want indexed, author archives on single-author sites and attachment pages.
  • Sitemap answers 404? Save Settings → Permalinks once, and check that "Discourage search engines" is not ticked.
  • Submit the one address in Google Search Console, and check it with the sitemap checker.

Where is my WordPress sitemap?

Open these addresses on your site in order; the first that shows a list is your sitemap:

SetupSitemap addressChild sitemaps look like
WordPress core, no SEO plugin/wp-sitemap.xml/wp-sitemap-posts-post-1.xml, /wp-sitemap-taxonomies-category-1.xml, /wp-sitemap-users-1.xml
Yoast SEO/sitemap_index.xml/post-sitemap.xml, /page-sitemap.xml, /category-sitemap.xml
Rank Math/sitemap_index.xml/post-sitemap.xml, /page-sitemap.xml, /category-sitemap.xml
All in One SEO/sitemap.xml/post-sitemap.xml, /page-sitemap.xml

Your robots.txt at /robots.txt should also name it on a Sitemap: line. WordPress core adds that line to its virtual robots.txt when its own sitemap is on, and Yoast and Rank Math add theirs. If you have a physical robots.txt file, you add the line yourself.

The guide to finding any site's sitemap covers other platforms and what to do when none of the usual paths answer.

The core WordPress sitemap

Since WordPress 5.5, core publishes a sitemap index at /wp-sitemap.xml with no plugin. It lists child sitemaps for each public post type (posts, pages and any custom post types), each public taxonomy (categories and tags) and users with published posts, which become author archive URLs. Each child file holds up to 2,000 URLs by default, according to the WordPress core developer notes, and a new file starts after that.

Since WordPress 6.5, core also writes a <lastmod> date for posts, taken from the post's last modified time. It does not write priority or changefreq, which Google ignores anyway.

What core does not give you is control from the admin. There is no screen to leave out tags, authors or a single page; that takes code, for example in a small plugin or your theme's functions.php:

PHP
// Leave author archives out of the core sitemap
add_filter( 'wp_sitemaps_add_provider', function ( $provider, $name ) {
    return 'users' === $name ? false : $provider;
}, 10, 2 );

// Leave tag archives out
add_filter( 'wp_sitemaps_taxonomies', function ( $taxonomies ) {
    unset( $taxonomies['post_tag'] );
    return $taxonomies;
} );

Core also switches its sitemap off completely when Settings → Reading → "Discourage search engines from indexing this site" is ticked. That is the most common reason a WordPress site has no sitemap after launch, and it means the whole site is asking not to be indexed. WordPress "Discourage search engines" explains the setting.

The Yoast SEO sitemap

Yoast SEO publishes its sitemap index at /sitemap_index.xml and turns the core sitemap off when its own is on, so the two never run side by side. The switch is under Yoast SEO → Settings → Site features → XML sitemaps.

What Yoast lists follows its search appearance settings rather than a separate sitemap list:

  • Content types and taxonomies. Under Yoast SEO → Settings, each content type and taxonomy has a "Show … in search results" toggle. Switching it off adds noindex to those pages and removes them from the sitemap in one step.
  • Single posts and pages. In the Yoast panel of the editor, under Advanced, setting "Allow search engines to show this content in search results?" to No does the same for one item.
  • Author archives. Switching author archives off under Settings → Advanced removes author-sitemap.xml.

Each child sitemap holds up to 1,000 entries by default, includes <lastmod> and lists the images in each post with <image:loc>. Developers can change the limit and exclude items by ID with Yoast's filters, such as wpseo_sitemap_entries_per_page and wpseo_exclude_from_sitemap_by_post_ids. Our recommended Yoast SEO settings include the sitemap choices.

The Rank Math sitemap

Rank Math also uses /sitemap_index.xml and switches the core sitemap off. Its settings are under Rank Math SEO → Sitemap Settings, split into tabs:

  • General: links per sitemap (200 by default), whether to include images, and fields to exclude posts or terms by ID.
  • Post types and Taxonomies: an "Include in sitemap" switch for each.
  • Authors: include or exclude the author sitemap.

Like Yoast, Rank Math leaves out items you set to noindex. Our recommended Rank Math settings cover the rest of the plugin.

Core, Yoast or Rank Math: which sitemap to keep?

WordPress coreYoast SEORank Math
Address/wp-sitemap.xml/sitemap_index.xml/sitemap_index.xml
URLs per child file2,0001,000200 (setting)
<lastmod>Posts, since 6.5YesYes
ImagesNoYesOptional
Exclude types or itemsCode onlySettings and filtersSettings
Drops noindex itemsNo, unless code filters themYesYes

The rule is simple: if an SEO plugin is active, use its sitemap; if not, use core's. Do not install a plugin only for the sitemap if core's lists the right pages. Do not run two SEO plugins, or an SEO plugin plus a separate sitemap plugin, either: each publishes its own sitemap, and the two list different URLs, archives and dates. Yoast and Rank Math together explains how to switch cleanly from one to the other.

When you switch, resubmit the new address in Search Console and remove the old one from the Sitemaps report, so Google stops reading a file that no longer exists.

What to leave out of a WordPress sitemap

A WordPress sitemap should list the pages you want in search results, and nothing else. The usual things to switch off:

  • Tag archives, unless each tag page is curated and useful. Most sites have hundreds of thin tag pages.
  • Author archives on single-author sites, where they duplicate the blog. See admin user and author archives.
  • Attachment pages: the thin page WordPress can create for every uploaded image. Since WordPress 6.4 they are off on new installs, and Yoast redirects them to the file by default. WordPress attachment pages shows how to check.
  • Post types a plugin created for its own use, such as form entries, portfolio items you never show, or landing-page builder templates.
  • Thank-you, cart, checkout and account pages. WooCommerce's cart, checkout and account pages should carry noindex and stay out.

Fix the setting, not the file: sitemaps in WordPress are generated on request, so manual edits would not survive anyway.

Fixing common WordPress sitemap errors

The sitemap answers 404

  1. Save the permalinks. Go to Settings → Permalinks and click Save Changes without changing anything. This rebuilds the rewrite rules that the sitemap URLs depend on, and fixes most 404s after activating an SEO plugin. The permalinks guide covers the settings.
  2. Check "Discourage search engines". It switches the core sitemap off.
  3. Check the server. On nginx, requests for .xml files can be served as static files and never reach WordPress; the location block needs try_files $uri $uri/ /index.php?$args;.

An old sitemap.xml file shadows the plugin

A physical sitemap.xml left in the web root by an old plugin or an upload is served before WordPress runs, so the stale file wins. Delete it by FTP or in the host's file manager, then load the sitemap address again.

The sitemap shows HTML, a blank page or an old version

Caching and security plugins sometimes cache the sitemap as HTML or block it for bots. Exclude sitemap URLs from page caching and from any firewall rule that challenges crawlers. If a CDN caches the file, purge it after changing sitemap settings.

"Couldn't fetch" or "has errors" in Search Console

The file must answer 200 with XML to Googlebot, not a login page or a firewall challenge. Every Search Console sitemap error and its fix is in XML sitemap validation.

How to check your WordPress sitemap

The sitemap checker finds your sitemap through robots.txt and /sitemap.xml, validates the XML, and requests up to 25 listed URLs to confirm they answer 200 without redirecting. On WordPress, a redirect in the sample usually means an attachment URL, a changed permalink or a http address after a move to HTTPS.

The WordPress checker looks for the classic launch mistakes from the outside, including a site still set to "Discourage search engines" and the attachment sitemap. When the sitemap looks right, submit it to Google.

Common mistakes

  • Submitting both /wp-sitemap.xml and /sitemap_index.xml. Only one exists when a plugin is active; remove the other from Search Console.
  • Installing a separate sitemap plugin next to Yoast or Rank Math.
  • Leaving tag and author archives in with hundreds of thin pages.
  • Launching with "Discourage search engines" still ticked from the staging site.
  • Editing a downloaded copy of the sitemap and uploading it. WordPress keeps serving its generated one, or yours goes stale.

Questions people ask

How do I find my sitemap in WordPress?

Add /wp-sitemap.xml to your domain if you have no SEO plugin, or /sitemap_index.xml if you use Yoast SEO or Rank Math; All in One SEO uses /sitemap.xml. Your robots.txt should also name it on a Sitemap: line. If none of these answer, check Settings → Reading for "Discourage search engines", then save your permalinks.

Does Yoast SEO create a sitemap automatically?

Yes. Yoast SEO publishes a sitemap index at /sitemap_index.xml as soon as it is active, with child sitemaps for posts, pages, categories and other public content, and it switches the core WordPress sitemap off. The toggle is under Yoast SEO → Settings → Site features → XML sitemaps. Pages you hide from search results in Yoast are left out automatically.

Should I disable the WordPress core sitemap?

Only if an SEO plugin provides one, and Yoast SEO and Rank Math already disable it for you. Without a plugin, keep the core sitemap: it is free, updates itself and lists every public post, page and archive. Use a few lines of code to leave out author or tag archives if you do not want them indexed.

Why is my Yoast sitemap showing a 404 error?

Usually because the rewrite rules need rebuilding: go to Settings → Permalinks and click Save Changes. Other causes are the XML sitemaps toggle being off in Yoast's site features, an old sitemap.xml file in the web root, a caching or security plugin intercepting the URL, or an nginx configuration that does not pass .xml requests to WordPress.

Check your site before and after Check