How to Create an XML Sitemap in WordPress: A Complete Guide
An XML sitemap is an important part of a WordPress website’s technical SEO setup. It helps search engines discover important URLs on your website and understand which content is available for crawling.
Creating a sitemap is relatively simple because modern WordPress installations can generate XML sitemaps automatically. SEO plugins can also provide additional sitemap controls and configuration options.
In this guide, you’ll learn what an XML sitemap is, why it matters, how to create one in WordPress, how to submit it to search engines, and how to troubleshoot common sitemap problems.
What Is an XML Sitemap?
An XML sitemap is a file that lists URLs from a website in a format that search engines can process.
For example, a sitemap can help search engines discover URLs such as:
https://example.com/
https://example.com/about/
https://example.com/services/
https://example.com/blog/
https://example.com/contact/
Unlike an HTML sitemap, which is designed primarily for website visitors, an XML sitemap is designed primarily for search engine crawlers.
A sitemap can be particularly useful for websites with:
- Many pages
- Frequently updated content
- Large archives
- New websites
- Complex internal linking
- Content that may be difficult for crawlers to discover through navigation alone
However, a sitemap does not guarantee that a URL will be crawled or indexed.
Why Is an XML Sitemap Important for WordPress?
Search engines can often discover pages through internal links, but a sitemap provides another way to communicate the URLs that are available on your website.
An XML sitemap can help with:
URL Discovery
It provides search engines with a structured list of URLs.
Large Websites
It can make URL discovery easier when a site contains many pages.
New Websites
Websites with few external links may benefit from having a sitemap available.
Frequently Updated Content
A sitemap can help search engines discover newly published content.
Website Monitoring
Submitting a sitemap through webmaster tools can provide information about sitemap processing and discovered URLs.
WordPress XML Sitemap vs. HTML Sitemap
These two sitemap types serve different purposes.
| Feature | XML Sitemap | HTML Sitemap |
|---|---|---|
| Primary audience | Search engines | Website visitors |
| Format | XML | HTML |
| Main purpose | URL discovery | Website navigation |
| Usually visible to visitors | No | Yes |
| Useful for SEO | Yes | Can support navigation and discoverability |
An XML sitemap should not be considered a replacement for good website navigation and internal linking.
Does WordPress Automatically Create an XML Sitemap?
Yes. Modern WordPress versions include built-in XML sitemap functionality.
A basic WordPress sitemap is generally available at:
https://example.com/wp-sitemap.xml
Replace example.com with your actual domain.
This means you may not need an SEO plugin just to create a basic XML sitemap.
However, SEO plugins can provide additional controls over sitemap content and other SEO settings.
Method 1: Create an XML Sitemap Using WordPress
The easiest approach is to use WordPress’s built-in sitemap functionality.
Step 1: Open Your Website
Open your WordPress website in a browser.
For example:
https://example.com/
Step 2: Add the Sitemap Path
Add:
/wp-sitemap.xml
to your domain.
For example:
https://example.com/wp-sitemap.xml
Step 3: Check the Sitemap
If your website supports the default WordPress sitemap, you should see an XML sitemap index.
It may contain links to different sitemap files for content types.
For example:
wp-sitemap-posts-post-1.xml
wp-sitemap-posts-page-1.xml
wp-sitemap-taxonomies-category-1.xml
The exact files depend on your website’s content and configuration.
Method 2: Create an XML Sitemap Using Yoast SEO
If you already use Yoast SEO, it can generate and manage XML sitemaps for your WordPress website.
After installing and activating Yoast SEO, the sitemap is generally available through a URL similar to:
https://example.com/sitemap_index.xml
Step 1: Install Yoast SEO
From the WordPress dashboard, go to:
Plugins → Add New Plugin
Search for:
Yoast SEO
Install and activate the plugin.
Step 2: Open Yoast SEO Settings
Go to the Yoast SEO settings area from your WordPress dashboard.
Review the available configuration options.
Yoast SEO generally manages the XML sitemap automatically after activation.
Step 3: Open the Sitemap
Visit:
https://example.com/sitemap_index.xml
You should see a sitemap index containing relevant sitemap files.
For example:
post-sitemap.xml
page-sitemap.xml
category-sitemap.xml
The exact sitemap structure depends on your website.
Method 3: Create an XML Sitemap With Another SEO Plugin
Other WordPress SEO plugins may also provide XML sitemap functionality.
Depending on the plugin, the sitemap might be generated automatically after activation.
The important point is to avoid having multiple plugins independently managing the same sitemap.
If you use an SEO plugin for sitemap generation, choose one primary sitemap system and verify that it works correctly.
What Should Be Included in a WordPress Sitemap?
Your sitemap should generally contain important, indexable URLs that you want search engines to discover.
For example:
- Important blog posts
- Useful pages
- Product pages
- Service pages
- Relevant category pages
- Other valuable public content
The exact URLs depend on your website structure.
What Should Not Be Included?
Avoid unnecessarily including URLs that don’t provide meaningful search value.
Depending on your website, this may include:
- Duplicate URLs
- Internal utility pages
- Certain filtered URLs
- Private content
- Pages intentionally marked
noindex - Low-value archive pages
- URLs returning errors
The goal isn’t to put every possible URL into the sitemap.
The sitemap should help search engines discover the URLs that matter.
How to Check if Your Sitemap Is Working
After creating your sitemap, open it directly in your browser.
For WordPress’s built-in sitemap:
https://example.com/wp-sitemap.xml
For Yoast SEO:
https://example.com/sitemap_index.xml
A working sitemap should load without a server error.
Check that:
- The sitemap URL is accessible
- URLs are valid
- Important content appears
- URLs use HTTPS where appropriate
- URLs don’t point to broken pages
- The sitemap isn’t blocked unintentionally
How to Submit an XML Sitemap to Google
Creating a sitemap is only part of the process. You can also submit it through Google Search Console.
Step 1: Open Google Search Console
Sign in to your Google Search Console account and select the appropriate website property.
Step 2: Open Sitemaps
Navigate to the sitemap section.
Step 3: Enter Your Sitemap
Depending on how your WordPress website generates the sitemap, enter the appropriate sitemap path.
For example:
wp-sitemap.xml
or:
sitemap_index.xml
Step 4: Submit the Sitemap
Submit the sitemap and allow Google to process it.
Search Console can subsequently show information about sitemap processing.
Remember that sitemap submission does not guarantee indexing.
How to Submit a Sitemap to Bing
Bing Webmaster Tools also provides sitemap submission and website monitoring features.
After verifying your website, you can submit the sitemap URL.
Use the sitemap generated by your WordPress installation or your selected SEO plugin.
XML Sitemap and Robots.txt
Your sitemap and robots.txt file serve different purposes.
XML Sitemap
Tells search engines about URLs you want them to discover.
Robots.txt
Provides crawling instructions for certain paths.
A sitemap can also be referenced from your robots.txt file.
For example:
Sitemap: https://example.com/wp-sitemap.xml
The exact sitemap URL depends on how your WordPress website generates it.
Should You Add Your Sitemap to Robots.txt?
It can be useful to include the sitemap location in robots.txt.
For example:
User-agent: *
Disallow:
Sitemap: https://example.com/wp-sitemap.xml
However, make sure your robots configuration is appropriate for your website before making changes.
Do not accidentally block important website sections.
How Often Does a Sitemap Need to Be Updated?
You generally don’t need to manually update a sitemap every time you publish an article.
WordPress and many SEO plugins can update the sitemap automatically when content changes.
For example, when you publish a new post, the URL can become available through the relevant sitemap automatically.
Still, periodically check that the sitemap is functioning correctly.
XML Sitemap Best Practices
1. Use HTTPS
If your website uses HTTPS, your sitemap should contain the HTTPS versions of your URLs.
2. Include Canonical URLs
The sitemap should generally contain the preferred versions of your pages.
3. Avoid Broken URLs
Don’t include URLs that return persistent 404 or server errors.
4. Keep the Sitemap Clean
Don’t fill your sitemap with unnecessary URLs.
5. Keep Your Website Structure Organized
A sitemap should complement good navigation and internal linking.
6. Monitor Sitemap Status
Check your sitemap periodically through webmaster tools.
7. Don’t Submit Multiple Conflicting Sitemaps
Multiple valid sitemaps can be useful for large websites, but avoid creating duplicate or conflicting sitemap systems unnecessarily.
XML Sitemap File Size and URL Limits
Search engines place limits on individual sitemap files.
A standard XML sitemap can contain up to 50,000 URLs or 50 MB of uncompressed data, whichever limit is reached first.
Large websites can use a sitemap index that references multiple sitemap files.
For example:
sitemap_index.xml
|
├── post-sitemap.xml
├── page-sitemap.xml
├── product-sitemap.xml
└── category-sitemap.xml
This structure allows large websites to organize their URLs across multiple sitemap files.
Common WordPress Sitemap Problems
Sitemap Returns a 404 Error
If:
/wp-sitemap.xml
doesn’t work, check your WordPress version and website configuration.
If you’re using an SEO plugin, check its sitemap URL instead.
Sitemap Is Empty
An empty sitemap can occur because of configuration problems or because there are no eligible URLs in a particular sitemap.
Review your indexing settings and SEO plugin configuration.
Sitemap Contains noindex Pages
If pages marked noindex appear in your sitemap, review your sitemap and indexing configuration.
Ideally, sitemap URLs should represent pages that you want search engines to consider.
Sitemap Is Blocked by Robots.txt
Check your robots.txt file.
Make sure you haven’t accidentally blocked the sitemap or important website resources.
Sitemap Shows the Wrong Domain
Check your:
Settings → General
configuration.
Review:
- WordPress Address
- Site Address
- HTTPS configuration
- WWW/non-WWW preference
Also check your SEO plugin settings.
Sitemap Is Not Updating
If newly published content doesn’t appear, clear relevant caches and check your sitemap configuration.
Caching plugins, server caching, CDN caching, or plugin conflicts can sometimes cause outdated responses.
Should You Use a Sitemap Plugin?
For many websites, WordPress’s built-in sitemap functionality is sufficient.
An SEO plugin may be useful when you want additional control over:
- Which content types appear
- Taxonomy archives
- Search appearance
- Robots settings
- Canonical URLs
- Other SEO features
You don’t need to install a dedicated sitemap plugin solely because your website needs an XML sitemap.
XML Sitemap vs. SEO Plugin
An XML sitemap is a specific SEO feature, while an SEO plugin typically provides a broader collection of tools.
| Feature | WordPress Sitemap | SEO Plugin |
|---|---|---|
| Basic XML sitemap | Yes | Usually |
| SEO titles | No | Yes |
| Meta descriptions | No | Yes |
| Canonical controls | Limited | Usually |
| Robots controls | Limited | Usually |
| Content analysis | No | Often |
| Social metadata | No | Often |
| Advanced SEO settings | Limited | Usually |
Choose tools based on your actual requirements rather than installing plugins simply because they are commonly recommended.
XML Sitemap Checklist for WordPress
Before considering your sitemap configuration complete, check the following:
- XML sitemap exists
- Sitemap loads successfully
- Important URLs are included
- Unnecessary URLs are excluded
- URLs use HTTPS
- Sitemap URLs are valid
- No important pages are accidentally excluded
- Sitemap isn’t blocked by robots.txt
- Sitemap is submitted to Google Search Console
- Sitemap is submitted to Bing Webmaster Tools if appropriate
- Sitemap updates when new content is published
- Broken URLs are removed or corrected
- Canonical URL configuration is consistent
Final Thoughts
Creating an XML sitemap in WordPress is relatively straightforward. Modern WordPress installations can generate a basic sitemap automatically, while SEO plugins such as Yoast SEO can provide additional sitemap and SEO management features.
The most important step is not simply creating the sitemap but making sure it contains useful, valid, indexable URLs and remains accessible to search engines.
For most WordPress websites, a practical approach is to enable the built-in sitemap or use your existing SEO plugin, verify the sitemap URL, submit it to relevant webmaster tools, and periodically check that it remains accurate.
A sitemap should work alongside good internal linking, useful content, proper indexing settings, mobile-friendly design, website performance, and sound technical SEO rather than being treated as a standalone ranking solution.