WordPress Sitemap – How to Create a Sitemap File for Your Site

In this tutorial I will be showing you how to create a WordPress sitemap file (ex. sitemap_index.xml) for your site. Sitemaps are used by Google, Bing, and Yandex as a hierarchy for your website. I highly recommend taking the time to create them and submit them properly to Google, Bing, and Yandex. If you aren’t running WordPress, see my other tutorial on “How to Create a Sitemap File Manually for your Website.” Setting up your sitemap file in WordPress is very easy, but I get asked this question so many times that I am taking the time to post it.

Creating a WordPress Sitemap File

Step 1

The first step is to install the WordPress plugin “WordPress SEO by Yoast.” This is the plugin I always recommend to generate your sitemap files if you are running WordPress, and it is completely free. I have used this plugin on hundreds of WordPress installs over the past 10 years. It currently is used by WordPress sites all around the world and has over 1 million active installs.

yoast seo

So in WordPress, let’s go down to the Plugins section and click on “Add New.” Then we will type in “WordPress SEO” and click on “Search Plugins.”

wordpress add new plugin

Step 2

Now we will click on “Install Now” on the plugin WordPress SEO by Yoast. (I always recommend backing up WordPress before installing any plugin, just to be safe. Or at least have FTP access ready)

install wordpress seo by yoast

Step 3

Now click on “Activate Plugin.”

activate yoast seo

Step 4

Now we will go down to “SEO” on the left-hand side and click into “XML Sitemaps.”

wordpress seo xml sitemaps

Step 5

Now we will make sure the the XML sitemap functionality is set on “enabled.” It should be enabled by default after you install the plugin.

enable wordpress xml sitemap

Step 6

Now click on the “XML Sitemap” button and open just to verify that directory permissions for writing the file are working and that the file looks ok.

confirm sitemap file

[alert-note]Note: If it says the file cannot be found then try disabling the sitemap option, saving, and then re-enabling the sitemap option. I have had to do this sometimes on first installs.[/alert-note]

Your sitemap file should show a list of your pages/posts and it will look similar to this. It is most likely located at the root of your site, example: https://woorkup.com/sitemap_index.xml. This is not an actual physical file. It is dynamically generated on the fly with PHP.

xml wordpress sitemap

This plugin will update the file automatically whenever you create/update a page or post in WordPress. So there is no need to ever create this file manually again.

Now that you have your sitemap file created make sure to check out my additional posts on how to properly submit them. Also note: Google will still index your site without a sitemap, but the data you can see in Google Search Console can be very beneficial.

Hopefully this tutorial on creating a WordPress sitemap file was helpful. As always feel free to leave your comments below!

author bio
Brian Jackson

I craft actionable content and develop performance-driven WordPress plugins. Connect on X, subscribe to my newsletter (once a month), or buy me coffee.

14 thoughts on “WordPress Sitemap – How to Create a Sitemap File for Your Site”

    • Hey Heather… I actually need to update this article. I made a note to do that this weekend. I am using the Yoast sitemap now :) So if you have the Yoast WordPress SEO plugin just make sure you have the sitemap checked.

  1. thanks

    i know how to do that, but i need another type of sitemap. the one you mentioned is for serch engines .. i want to add sitemap to visitors of my website.

  2. Good writeup, but notice the links on the sitemap page are DOFOLLOW. Didn’t see where in the plugin php files this was being generated from (maybe a php include?). Thoughts?

    • That is interesting Dave :) Never noticed that before. Seems there is a dofollow link to Yoast and sitemaps.org. However since the sitemap is an XML file, not an indexed webpage in Google, I don’t think Google treats it the same way and therefore I doubt it is generating any link juice, even though my plugin show the links as dofollow.

  3. If the sitemap is submitted to a wordpress blog, does it automatically update when a new post is made on the blog? Or do we have to update the sitemap manually every time we create a new post?

    Shalin@ creately

  4. Hey marc… You don’t have to use www to use a CDN. None of my sites have www and I use CDNs just fine. If you switched everything over from non-www to www and didn’t do any 301 redirects that is why you lost all your rankings.

    My advice, go back to non-www and setup CDN so it works with non-www. Your rankings should soon then return… however, don’t wait too long.

    • Hi Brian, Thank you very much for taking the time to reply. I only changed it due to advice from my hosting provider (Siteground) as when I started to use a CDN I was getting a very strange message inside WP about my root file having an error. They said that it was because of this www. and fixed it for me. I tried to change it back but found that it would instantly go back to www. as soon as I connected the CDN (Cloudflare)…I am fine with using www. but it is now a redirect, my rankings seem to have to come back and also they showed me the best way to get new pages indexed by using Google Webmasters “Fetch” and then index….so now the problem seems to be solved with my current posts but I am curious when I add another post or review today. Do you maybe have an article written on here about setting up your CDN without www. ? Also because my site is now redirected when I check with market samurai it shows that I have no backlinks…where as before I had 100’s….will all the SEO that I have done still help with rankings even if I can not see them, ie, SEO through a redirect? Here you can see that it looks like I have done no SEO even though I have 2 years of manual linkbuilding – http://screencast.com/t/2z3gYvje70

      I’m sorry that this post is so long…any links to your other articles about this subject would be much appreciated! I would love to get back to having no www.

      I am so glad that I found your site, I have already used your tips from 3 articles and have this site open all the time now!

      Thanks in advance,,.



Leave a Comment