Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

SEO & AI search · Guide

How to Create an XML Sitemap in WordPress

Short answer

WordPress already creates an XML sitemap at /wp-sitemap.xml, and you can view it in your browser with no setup. For more control, turn on the sitemap in Yoast SEO or Rank Math, then submit the sitemap index URL in Google Search Console so Google can find your pages faster.

Key takeaways

  • WordPress has built an XML sitemap into core since version 5.5, and it lives at /wp-sitemap.xml.
  • A single core sitemap holds up to 2,000 URLs, and the index can hold up to 50,000 sitemaps.
  • Yoast SEO and Rank Math replace the core sitemap with their own index at /sitemap_index.xml.
  • Submitting a sitemap in Search Console is only a hint; it does not guarantee Google will index a page.
  • A sitemap should list only pages that return a 200 status and that you want in search results.

What is an XML sitemap?

An XML sitemap is a file that lists the pages on your site so search engines can find and crawl them.

It is written for search engines, not for visitors. Each entry holds a page URL plus facts about it, such as when it was last updated. The sitemap protocol site describes it as a simple way to tell crawlers which pages are open for crawling.

A sitemap does not force Google to index a page. The sitemaps.org protocol states clearly that using a sitemap does not guarantee that pages will be included in search engines. It only gives crawlers a hint about where to look.

Even so, a sitemap helps on sites with pages that are hard to reach by links alone. Deep pages, new posts and pages with few links from elsewhere all benefit from being listed in one place.

Does WordPress create a sitemap on its own?

Yes. WordPress has built an XML sitemap into core since version 5.5, with no plugin and no setup needed.

The core sitemap lives at /wp-sitemap.xml and acts as an index that points to smaller sitemaps for posts, pages, taxonomies and authors. It covers all public post types and taxonomies, plus author archives and the homepage, as the Make WordPress Core dev note explains.

Each single sitemap holds up to 2,000 entries, and the index can hold up to 50,000 sitemaps. Those limits come from the same dev note, and they are far above what most small sites will ever need.

WordPress also adds a Sitemap: line to its virtual robots.txt file, so search engines can find the sitemap on their own. If you run an SEO plugin, that plugin usually takes over and turns the core sitemap off.

How do you find your WordPress sitemap?

Open your site address with /wp-sitemap.xml added at the end, and the sitemap index should load in your browser.

The index lists links to the smaller sitemaps, such as wp-sitemap-posts-post-1.xml for posts and wp-sitemap-posts-page-1.xml for pages. Click any link to see the URLs it holds.

If the sitemap does not load, check Settings, then Reading, in your dashboard. The Learn WordPress lesson on sitemaps notes that the “Discourage search engines from indexing this site” box must be off, or WordPress will not generate a sitemap at all.

Your site may also answer at /sitemap.xml instead. That address usually belongs to an SEO plugin, which redirects it to its own index. If neither address loads, an SEO plugin may have its sitemap feature turned off, or your host may be missing the SimpleXML PHP extension that core sitemaps need.

How do you create a sitemap with Yoast SEO?

Turn on the XML sitemaps feature in Yoast SEO, then open the sitemap it creates at /sitemap_index.xml.

  1. Go to Yoast SEO, then Settings in your WordPress dashboard.
  2. Open the Site features tab.
  3. Under Technical SEO, slide the XML sitemaps toggle to On.
  4. Click View the XML sitemap to open the index in a new tab.

Yoast's sitemap help page says the index and its sitemaps update on their own as you add or remove content. You never need to rebuild the file by hand.

Yoast leaves out any post type marked noindex, so pages you hide from search stay out of the sitemap too. If a page is missing from the sitemap, check its Yoast settings first.

Yoast also adds an x-robots-tag header with the value noindex, follow to its sitemap pages. That keeps the sitemap itself out of search results while still letting crawlers follow its links.

For the full setup, our Yoast setup guide walks through each screen in order.

How do you create a sitemap with Rank Math?

Open Rank Math's Sitemap Settings, adjust what goes in, and Rank Math serves its own index at /sitemap_index.xml.

Rank Math's sitemap guide puts the settings at Rank Math SEO, then Sitemap Settings. The General tab holds the main controls, and each content type gets its own tab.

The Links Per Sitemap setting caps how many URLs go on one sitemap page. Rank Math's docs say Google caps a single sitemap at 50,000 URLs, but Rank Math lowered its own default to 200 links per page because smaller sitemap pages tend to work better.

Images are part of the sitemap by default. Rank Math's guide notes that image sitemaps are on unless you switch them off, and you can also include featured images so they show in image search.

Rank Math also offers an HTML sitemap, which is a page of links for visitors rather than for search engines. You can show it with a shortcode or assign it to a page. Our Rank Math setup guide covers the plugin's first-run steps.

How do you submit your sitemap to Google?

Submit the sitemap index URL in Google Search Console, under the Sitemaps report, and Google will fetch it and list the URLs it found.

Google's sitemap guide lists three ways to hand Google your sitemap: the Search Console Sitemaps report, the Search Console API, or a Sitemap: line in your robots.txt file.

A single sitemap must stay under 50 MB uncompressed or 50,000 URLs, per Google's guide. If your site is larger, split it into several sitemaps and submit the index file, which Google accepts as one submission.

Submitting the sitemap is only a hint. Google's guide says it does not guarantee that Google will download the sitemap or use it to crawl your URLs. It still helps Google find new pages sooner than link crawling alone.

After you submit, check the Sitemaps report for errors. If Google reports that it could not fetch the file, the URL may be wrong, the file may be blocked, or the sitemap may be empty.

What should you leave out of a sitemap?

Leave out any page you do not want in search results, such as drafts, private pages, thank-you pages and login pages.

A sitemap should list only URLs that return a 200 status and that you want indexed. Pages marked noindex, pages behind a login and pages that redirect to somewhere else do not belong there.

Yoast and Rank Math both skip noindex content on their own. But they cannot know that a thank-you page or an internal tool page should stay out, so check the content type settings and exclude those by hand.

Duplicate URLs cause trouble too. If the same content appears under two addresses, list only the canonical one. If a page is missing from your sitemap and you expected it there, our crawled but not indexed guide explains the common causes.

What if your sitemap is blank or returns an error?

First, check whether an SEO plugin has taken over the sitemap, then flush your permalinks and check for a conflicting plugin.

A blank sitemap often means two sitemap tools are fighting. When Yoast or Rank Math is active, it disables the core sitemap, so /wp-sitemap.xml stops working and /sitemap_index.xml is the right address.

Yoast's help page notes that a sitemap at example.com/sitemap.xml is not made by Yoast, and points to another plugin or core as the source.

If the sitemap returns a 404, go to Settings, then Permalinks, and click Save Changes without changing anything. That refreshes the rewrite rules that make the sitemap address work.

If it still fails, turn off other SEO and sitemap plugins one at a time and reload the sitemap after each. Our sitemap not working guide covers this in more detail.

For the Yoast-specific case, see our Yoast sitemap 404 guide.

What mistakes should you avoid?

The biggest mistake is running two sitemap tools at once, which leaves Google unsure which file to trust.

  • Do not upload a static sitemap.xml file to your site root; it goes stale with the first new post.
  • Do not list pages that return 404 errors or redirect elsewhere.
  • Do not include admin, login or search-result pages.
  • Do not submit the sitemap for the wrong domain, such as the www version when your site uses the plain domain.
  • Do not expect the sitemap alone to get a page indexed; the page still needs links and useful content.
  • Do not forget to check the sitemap after a plugin change, since a new plugin may have replaced it.
Sitemap sourceIndex URLWhat it coversNotes
WordPress core/wp-sitemap.xmlPosts, pages, taxonomies, authorsBuilt in since 5.5, max 2,000 URLs per file
Yoast SEO/sitemap_index.xmlPosts, pages, taxonomies, media, authorsUpdates on its own, skips noindex content
Rank Math/sitemap_index.xmlPosts, pages, taxonomies, images, authorsDefault 200 links per sitemap page, HTML sitemap option

Pick one source and stick with it. One clean sitemap beats three competing ones.

Frequently asked questions

Do I need a plugin to create an XML sitemap in WordPress?

No. WordPress has generated an XML sitemap at /wp-sitemap.xml since version 5.5, with no plugin needed. An SEO plugin such as Yoast or Rank Math replaces it with a more detailed sitemap, but the core sitemap is enough for a simple site.

How do I know if my page is in the sitemap?

Open your sitemap index and check that the URL is listed. Then open Google Search Console, go to the Sitemaps report, and confirm Google fetched the file without errors. If the page is missing, check whether it is marked noindex or excluded in your sitemap settings.

What is the difference between an XML sitemap and an HTML sitemap?

A sitemap is a file for search engines that lists your pages in XML. An HTML sitemap is a page of links for visitors. WordPress core and SEO plugins make XML sitemaps; Rank Math also offers an HTML sitemap you can show with a shortcode or on a page.

Why is my page not indexed even though it is in the sitemap?

Google may still take time to crawl and index the page, since a sitemap is only a hint. Check that the page returns a 200 status, is not marked noindex, and has links pointing to it from other pages on your site.

Do I need separate image and video sitemaps?

No. Image, video and news sitemaps are extras that most small sites do not need. WordPress core and Yoast cover the basic pages, and Rank Math can add image entries. Add a video or news sitemap only if that content is a large part of your site.

Sources

  1. XML Sitemaps in WordPress 5.5 Make WordPress Core
  2. Building a Sitemap for a Site Learn WordPress
  3. Build and Submit a Sitemap Google Search Central
  4. Sitemaps XML format sitemaps.org
  5. XML sitemaps in the Yoast SEO plugin Yoast
  6. How to Configure Sitemaps in Rank Math Rank Math

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test