How to Add an XML Sitemap to WordPress (Step-By-Step Guide)
Learn how to add an XML sitemap to WordPress, generate it with Yoast or All in One SEO, upload it, and submit it in Google Search Console.

What an XML sitemap is (and what it does)
An XML sitemap is a structured list of your website’s key pages and posts. It helps search engine crawlers find and index content more reliably. For SEO and site visibility, that means fewer missed pages after new posts go live.
Think of a sitemap as a map. Crawlers still discover links through regular navigation, but the sitemap provides a clear index. It can also include metadata like when a URL was last updated, which can speed up re-crawling.
- It lists URLs in a machine-readable XML format.
- It can include last-modified dates.
- It helps with search engine indexing and discovery.

Why your WordPress site needs a sitemap
WordPress websites grow over time. New posts, tags, and category pages get added, and older pages change. A sitemap gives crawlers a consistent snapshot of what to crawl.
This matters most when your site has complex structure or lots of archives. For example, a blog with 300 posts plus tag pages can be harder to crawl efficiently than a small site. A sitemap can also help when you have recently migrated content and want faster re-discovery.
There are two main sitemap styles. Dynamic sitemaps update automatically as your content changes. Static sitemaps are generated once and then require manual updates when you publish new URLs.
- Dynamic vs static sitemaps: dynamic updates automatically; static needs manual refresh.
- Indexing: better crawling coverage can lead to better indexing outcomes.
- Website optimization: you spend less time troubleshooting “missing” pages.

How to create an XML sitemap for WordPress
If you are searching for how to create xml sitemap for wordpress, the simplest answer is usually “use a plugin.” Most WordPress SEO plugins generate a sitemap automatically and keep it updated. That’s the fastest path for most sites.
However, you can also create a sitemap without a plugin. If your site has fewer than about 500 URLs, manual creation is often practical. That threshold is not a hard rule, but it keeps file size and update effort manageable.
Here are two common approaches before you upload anything.
- Plugin-generated sitemap: install a WordPress SEO plugin, enable sitemap output, and let it update.
- Manual sitemap: build the XML file yourself in PHP or via an online generator, then upload it.
When creating your own XML, aim to include the canonical URLs you want indexed. Exclude duplicate variants like multiple parameters where possible. Also make sure your sitemap matches your intended content structure, such as whether tag pages should be indexed.
Enable XML sitemap in WordPress with Yoast SEO
Yoast SEO is one of the most common WordPress plugins for sitemaps. To enable xml sitemap in wordpress with Yoast SEO, install and activate the plugin, then go to its sitemap settings. In many cases, the sitemap is enabled out of the box after activation, but you should still confirm.
In Yoast SEO, look for a “SEO” section in the WordPress admin menu. Then open “Search Appearance” or “General,” depending on your Yoast version. You should find an option labeled for XML sitemaps. Turn it on and save changes.
After enabling it, Yoast provides a sitemap URL. A common pattern is /sitemap_index.xml for many sites, or /sitemap.xml in smaller setups. Open the sitemap in your browser to confirm it lists your posts and pages without errors.
- Install Yoast SEO and activate it.
- Turn on the XML sitemap option in Yoast settings.
- Verify the sitemap URL in your browser.
Create sitemaps with All in One SEO
All in One SEO is another popular plugin for sitemap generation. If your goal is how to add xml sitemap to wordpress with minimal effort, this plugin can be a quick win. The workflow is similar to Yoast: enable the sitemap feature, then verify the output.
In the WordPress admin, open the All in One SEO settings page. Find the option for XML sitemap and switch it on. Some versions let you choose which content types to include, like posts, pages, or media.
When you save the settings, All in One SEO creates the sitemap automatically. You can then visit the sitemap URL to confirm it includes your latest content. If you have multiple content types, check that the sitemap covers what you actually want indexed.
| Plugin | What to check after enabling |
|---|---|
| Yoast SEO | Sitemap URL loads and lists recent posts |
| All in One SEO | Included content types match your indexing goals |
Manual creation and upload of an XML sitemap
If you want to control everything yourself, you can create the XML file manually. This can be done by coding a generator in PHP. You can also use an online generator when your site has fewer URLs.
After you have the XML content ready, the next part is how to upload xml sitemap to wordpress. The key rule is placement: upload the sitemap to the root directory of your website. “Root” means the top-level folder where wp-content and wp-admin live, not a theme folder.
Common filenames include sitemap.xml or sitemap_index.xml. If your sitemap is at the root, its public URL usually looks like https://example.com/sitemap.xml.
- Create your sitemap XML file and name it, like sitemap.xml.
- Upload it to your site’s root directory via FTP or file manager.
- Open the public URL in a browser to confirm it loads.
For static sitemaps, remember that you must update the file after publishing. Dynamic generation avoids this recurring maintenance step.
If you are experimenting with server-side sitemap code, also confirm your site supports the method you use to fetch URLs. Some setups use WordPress APIs that rely on XML-RPC. If you ever need XML-RPC for a custom sync flow, review whether it is enabled and safe for your site. For most standard sitemap workflows, you can avoid XML-RPC entirely.
Submitting your sitemap to Google Search Console
Creating a sitemap is only half the job. Search engines still need to learn where it is. The final step in how to add xml sitemap to wordpress for indexing is submit wordpress sitemap to google via Google Search Console.
Start by adding and verifying your domain or URL prefix in Google Search Console. Then open the “Sitemaps” report. Paste your sitemap URL, usually ending in sitemap.xml or sitemap_index.xml, and submit it.
After submission, watch for “Success” status and check for errors. Google may re-crawl over the next few days. If you recently published many pages, it can take longer, depending on crawl budget and site changes.
- Verify your site in Google Search Console.
- Open the Sitemaps report.
- Submit your sitemap URL and monitor indexing status.
If you change your sitemap settings or regenerate the file, submit again. That helps ensure Google reads the most current structure.
Common issues that block sitemap indexing
Even when the sitemap exists, mistakes can prevent effective crawling. One issue is incorrect placement. If you upload it inside a subfolder, Google will not find it at the URL you submit.
Another issue is empty or incomplete sitemaps. This can happen if a plugin is disabled, content types are excluded, or caching blocks the output. Always open the sitemap URL directly and confirm that it lists your expected URLs.
Finally, watch out for duplicates and canonical mismatches. If your sitemap includes URLs you later redirect, Google may ignore them or spend extra crawl effort. Keep sitemap URLs aligned with your canonical choice.
Quick checklist for getting it working
Use this as a practical sanity check after you enable or create your sitemap. The goal is to confirm that Google has a valid, updated sitemap URL.
- You can open the sitemap URL in a browser.
- The sitemap lists your recent posts or key pages.
- The file is accessible at the submitted address.
- You submitted it in Google Search Console.
- Errors are resolved after submission.
If you want the shortest path, choose Yoast SEO or All in One SEO. Then verify the sitemap URL and submit it. That combination usually delivers strong indexing results without extra maintenance.
FAQ
- How do I add an XML sitemap to WordPress?
- Enable XML sitemaps in a WordPress SEO plugin like Yoast SEO or All in One SEO. Then confirm the sitemap URL loads and submit it in Google Search Console.
- What is the difference between dynamic and static sitemaps in WordPress?
- Dynamic sitemaps update as you publish or change content. Static sitemaps require you to recreate and re-upload the XML file.
- How do I create an XML sitemap for WordPress without a plugin?
- You can generate the sitemap XML with PHP or an online generator. Then upload it to your site root as sitemap.xml or sitemap_index.xml.
- How do I upload an XML sitemap to WordPress?
- Upload the XML file to the root directory of your domain, not inside wp-content or a theme folder. Verify the public URL works in your browser.
- How do I enable an XML sitemap in WordPress with Yoast SEO?
- Install Yoast SEO, then turn on the XML sitemap option in the plugin settings. After saving, open the provided sitemap URL to verify output.
- How do I submit my WordPress sitemap to Google?
- In Google Search Console, open the Sitemaps report and submit your sitemap URL. Then monitor status and errors until indexing looks healthy.


