How to Create an XML Sitemap in WordPress

You've published great content on your WordPress site. But if Google can't find it, it can't rank it.

An XML sitemap is a file that lists all the important pages, posts, and other content on your website in a structured format that search engines can easily read. Submitting it to Google dramatically speeds up the discovery and indexing of your content — making it one of the most important SEO setup tasks for any WordPress site.

This guide covers everything about XML sitemaps in WordPress: what they are, why they matter, how to create one using your SEO plugin, how to submit it to Google Search Console, and how to troubleshoot sitemap problems.

What Is an XML Sitemap?

An XML sitemap is a file (usually at yourdomain.com/sitemap.xml or yourdomain.com/sitemap_index.xml) that contains a structured list of URLs on your website, along with optional metadata like:

  • When the URL was last modified
  • How frequently it changes
  • Its relative priority

Here's a simplified example of what an XML sitemap looks like:

XML
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://yourdomain.com/wordpress-development/</loc>
    <lastmod>2025-01-15</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>https://yourdomain.com/blog/wordpress-speed-tips/</loc>
    <lastmod>2025-01-10</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.6</priority>
  </url>
</urlset>

Search engine crawlers (Googlebot, Bingbot, etc.) read your sitemap and use it as a map of your site — discovering URLs they might not find through regular link-following alone.

Why XML Sitemaps Matter for WordPress SEO

  • Faster indexing. New content you publish isn't automatically discovered by Google — Googlebot needs to crawl and find it. With a sitemap, you're directly telling Google what to crawl. New posts and pages get indexed days or weeks faster than without a sitemap.
  • Guaranteed discovery of all pages. Even if some pages on your site aren't well-linked internally, the sitemap ensures Google knows they exist. This is especially important for large sites, new sites, or sites with content that doesn't receive many internal links.
  • Efficient crawl budget use. For large sites, Google allocates a crawl budget — a limit on how many pages it crawls in a given period. A well-structured sitemap helps Google spend its crawl budget on your important content rather than unimportant pages.
  • Image and video indexing. Image sitemaps and video sitemaps help Google discover and index your media content — improving image search visibility.
  • Signals content freshness. The lastmod timestamp in your sitemap tells Google when content was last updated, prompting re-crawls of updated content.
01
Create an XML Sitemap with Rank Math (Free)

Rank Math generates a comprehensive XML sitemap automatically. Here's how to configure it:

Enable Rank Math Sitemap:

  1. Log in to WordPress
  2. Go to Rank Math → Sitemap Settings
  3. Ensure "Sitemap Index" is enabled

Configure What's Included:

In Rank Math → Sitemap Settings, you'll see modules for each content type:

Posts Sitemap:

  • Enable: Yes (include all published posts)
  • Include Featured Images: Yes (adds image sitemap data)
  • Exclude specific posts if needed

Pages Sitemap:

  • Enable: Yes
  • Exclude: Add any pages you don't want indexed (privacy policy, thank you pages, etc.)

Categories/Tags Sitemap:

  • Categories: Enable if your category pages have meaningful content
  • Tags: Usually disable — tags often create thin content pages

Authors Sitemap:

  • Enable only for multi-author sites where author pages have meaningful content
  • Disable for single-author sites

Check Your Sitemap URL:

Your Rank Math sitemap is at:

URL
https://yourdomain.com/sitemap_index.xml

This is a sitemap index — a master file that links to separate sitemaps for each content type:

  • https://yourdomain.com/page-sitemap.xml — all pages
  • https://yourdomain.com/post-sitemap.xml — all posts
  • https://yourdomain.com/category-sitemap.xml — categories

Visit the sitemap index URL and verify it loads and shows your content types.

02
Create an XML Sitemap with Yoast SEO (Free)

Enable Yoast Sitemap:

  1. Go to Yoast SEO → General → Features
  2. Ensure "XML Sitemaps" is toggled ON
  3. Save changes

Configure Sitemap Content:

  1. Go to Yoast SEO → Search Appearance
  2. For each content type (Posts, Pages, Categories, Tags, etc.):
  3. If set to "Show in search results: Yes" → it will be included in the sitemap
  4. If set to "No" (noindex) → it will be excluded from the sitemap

Recommended settings for most WordPress sites:

  • Posts: Yes (include)
  • Pages: Yes (include, but exclude specific pages like thank-you, cart, checkout)
  • Categories: Yes (if they have good content)
  • Tags: No (usually thin content — noindex and exclude from sitemap)
  • Author archives: No (unless multi-author)
  • Date archives: No

Check Your Yoast Sitemap:

URL
https://yourdomain.com/sitemap_index.xml

Click the "See the XML sitemap" link in Yoast settings to view it directly.

03
Create a Sitemap with Google XML Sitemaps Plugin

If you don't use Rank Math or Yoast, Google XML Sitemaps is a dedicated, lightweight option:

  1. Install Google XML Sitemaps from wordpress.org
  2. Activate — the sitemap is generated automatically
  3. Go to Settings → XML Sitemap to configure included content types, priorities, and change frequency

Your sitemap is at yourdomain.com/sitemap.xml

How to Submit Your Sitemap to Google Search Console

Creating the sitemap is only half the work. Submitting it to Google Search Console ensures Google knows where to find it.

Step 1: Verify Your Site in Google Search Console

If you haven't set up GSC yet:

  1. Go to search.google.com/search-console
  2. Click Add Property and enter your domain
  3. Verify ownership via your SEO plugin's webmaster verification code field

Step 2: Submit Your Sitemap

  1. In Google Search Console, click your property
  2. Go to Sitemaps in the left sidebar
  3. In the "Add a new sitemap" field, enter your sitemap URL (just the path, not the full URL):
Sitemap paths by plugin: sitemap_index.xml — for Rank Math or Yoast
sitemap.xml — for Google XML Sitemaps plugin
  1. Click Submit

Step 3: Verify Submission Status

After submission, Google Search Console shows:

  • Success — Google has fetched your sitemap successfully
  • Pending — Google hasn't fetched it yet (check back in a few hours)
  • Error — Something is wrong with your sitemap (see troubleshooting below)

The Discovered URLs count shows how many URLs Google found in your sitemap. This may be lower than your total URL count — Google doesn't necessarily index every URL it discovers.

Submit to Bing Webmaster Tools

Don't neglect Bing — it powers Bing, DuckDuckGo, and several other search engines:

  1. Go to bing.com/webmasters
  2. Add your site
  3. Go to Sitemaps → Submit a Sitemap
  4. Enter your sitemap URL

What to Include (and Exclude) in Your WordPress Sitemap

Always Include

  • All published blog posts
  • All important pages (homepage, about, services, contact)
  • Product pages (WooCommerce)
  • Category pages (if they have meaningful content — introductory text, featured posts)

Usually Exclude

  • Thank you pages — no SEO value, shouldn't be indexed
  • Cart and checkout pages — WooCommerce specific, should be noindexed
  • Login and registration pages — no SEO value
  • Tag archives — usually thin content
  • Date archives — thin content, rarely useful for SEO
  • Author archives — single-author sites only; multi-author may include
  • Attachment pages — WordPress creates pages for every uploaded image; these are almost always thin content
  • 404 pages and search results pages — WordPress SEO plugins exclude these automatically

Excluding Specific Pages in Rank Math:

  1. Open the post or page in the WordPress editor
  2. In the Rank Math panel → Advanced tab
  3. Set "Robots Meta" to "No Index"
  4. The page is automatically removed from the sitemap

Excluding Specific Pages in Yoast:

  1. Open the post or page in the editor
  2. In the Yoast panel → Advanced tab
  3. Set "Allow search engines to show this Post in search results?" to "No"

Image Sitemaps in WordPress

An image sitemap extends your XML sitemap to include information about images on each page — helping Google index your images in Google Images search.

  • Rank Math: Automatically includes image sitemap data when you enable "Include Images in Sitemap" in sitemap settings.
  • Yoast SEO: Automatically includes image data in page/post sitemaps.

For sites where image search traffic matters (photography, recipes, products, design), verify your images are appearing in your sitemap by viewing the raw XML:

URL
https://yourdomain.com/post-sitemap.xml

Look for <image:image> tags within each URL entry — these confirm image sitemap data is included.

Sitemap Troubleshooting

Problem Cause Fix
Sitemap returns 404 Not Found Permalink rules haven't been flushed since the SEO plugin was activated Go to Settings → Permalinks and click Save Changes (without changing anything). This regenerates the .htaccess rewrite rules that make the sitemap URL work.
Sitemap shows no URLs Content types are set to noindex, or the sitemap isn't finding published content Check your SEO plugin's search appearance settings and ensure your content types are set to "Yes" for indexing. Also check that you have published posts and pages.
"Couldn't fetch" in GSC Google can't access your sitemap URL Check if the URL is correct and that the sitemap is publicly accessible (not blocked by a plugin or robots.txt).
"No URLs found in sitemap" Sitemap XML is valid but contains no <url> entries Check your SEO plugin settings — content types may be excluded.
"Indexed, though blocked by robots.txt" Sitemap URLs are listed but blocked by robots.txt Check your robots.txt file for Disallow: / or overly broad disallow rules.
Pages not appearing in sitemap Individual page is set to noindex, or its content type is excluded Check whether the individual page is set to noindex in the SEO plugin's meta settings. Also check that the content type is included in sitemap settings.

Monitoring Sitemap Performance in Search Console

After submission, use Google Search Console to monitor:

Sitemaps report:

  • Total submitted URLs vs. indexed URLs
  • If indexed < submitted significantly, investigate why Google isn't indexing those URLs

Coverage report (Indexing → Pages):

  • "Submitted in sitemap but not indexed" — URLs Google found but chose not to index
  • "Discovered – currently not indexed" — Google knows about them but hasn't crawled yet

URL Inspection:

For any specific URL, use URL Inspection to check if it's indexed and when it was last crawled.

Frequently Asked Questions

Q: How often does WordPress update the XML sitemap?
A: Both Rank Math and Yoast update the sitemap dynamically — every time you publish, update, or delete content, the sitemap reflects the change immediately. There's no manual refresh required.
Q: Should I include my categories in the sitemap?
A: Include categories if they have good content — a descriptive intro, featured posts, or regular updates. Exclude or noindex empty categories or those with only one or two posts.
Q: My sitemap has 500 URLs but Google has only indexed 200. Is that a problem?
A: Not necessarily. Google decides which URLs to index based on quality, duplicate content, crawl budget, and other factors. If important pages aren't being indexed, investigate via URL Inspection in Search Console. For low-quality or thin pages, being excluded from Google's index is actually fine.
Q: Can I have too many URLs in my sitemap?
A: Google recommends keeping sitemaps under 50,000 URLs and 50MB uncompressed. Most WordPress sites are well under this. If you exceed it, your SEO plugin will automatically split content into multiple sitemap files (which is what the sitemap index handles).

Final Thoughts

Creating and submitting an XML sitemap is one of the most straightforward and impactful SEO steps you can take for your WordPress site. Install your SEO plugin, verify the sitemap at your sitemap index URL, submit it to Google Search Console, and monitor the indexed URL count over time.

Combined with good content, proper on-page optimisation, and a technically sound site, a well-configured sitemap ensures Google discovers and indexes your content as quickly as possible.

Need help with WordPress SEO setup including sitemap configuration? Our team handles full SEO implementations for WordPress sites.

Contact us today and we'll sort it out.
Views: 247