Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

What is an XML Sitemap? How to Create a Sitemap in WordPress?

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
What is an XML Sitemap? How to Create a Sitemap in WordPress?

Back in early 2000s, government websites used to have a link on their main pages, titled “Sitemap”. This page usually contained a list of all the pages on that website. Even today some websites have such HTML sitemaps. However, sitemaps have evolved so much from the manually created HTML bulleted list. Today sitemaps are published in XML instead of HTML and their target audience is search engines and not people. Recently one of our users sent us an email asking us: what is a WordPress sitemap? Do I need to have a sitemap on my site? How can I create a sitemap in WordPress? If you are new to WordPress and had the same questions, then you are at the right place. In this article we will explain what is a sitemap, why you need a sitemap, how to create a sitemap in WordPress, and how to tell search engines about your sitemaps.

What is a WordPress XML Sitemap?

Sitemap is a list of pages on a website that is accessible to all users. An XML sitemap is a way for website owners to tell search engines about all the pages that exist on their website. WordPress XML sitemap also tells search engines which links on your website are more important than others and how frequently you update your website. While sitemaps do not boost your search rankings, it allows search engines to better crawl your website.

Screenshot of WPBeginner posts sitemap

Why You Need an XML Sitemap

From a Search Engine Optimization (SEO) point of view sitemaps are extremely important. First we would like to clearly state that adding a sitemap does not affect search rankings. However, if there is some page on your site that is not indexed, then sitemap provide you a way to let search engines know about that page, so it can be indexed properly.

Sitemaps are very useful for new websites and blogs. As most new blogs usually don’t get many backlinks to their individual posts, it becomes harder for search engines to discover all of their posts and pages. Sitemaps allow those websites to help search engines crawl their sites more efficiently.

For popular websites, sitemaps allow your website to interact with search engines more effectively. Search engines can guess how often your site is updated, which parts of your website are more frequently updated than others, set crawl rate for your site, etc. This improves the overall visibility of your site to search engines.

Video Tutorial

If you don’t like the video or need more instructions, then continue reading.

How to create a Sitemap in WordPress?

There are several ways to create an XML sitemap in WordPress. At WPBeginner, we use Yoast’s WordPress SEO plugin to generate our sitemaps. We use this plugin because it allows us to optimize our blog posts along with offering other features such as sitemaps, social integration, and more. We have also noticed that it works more efficnelty than other standalone sitemap generators for WordPress. Lastly, it also offers custom sitemaps like the Video Sitemap.

To add a sitemap to your WordPress site, first thing you need to do is install and activate WordPress SEO by Yoast plugin. By default, WordPress SEO does not enable XML sitemap functionality, so you will have to turn it on. To do that go to SEO » XML Sitemaps and check the box to enable XML sitemap functionality.

Enable XML WordPress Sitemaps in WordPress SEO plugin

When you check the box to enable XML sitemap functionality, WordPress SEO will show you a number of options that you can configure for your Sitemaps. If you are unsure about what to do with them, then ignore them and click on Save settings.

Now your sitemaps are generated and publicly accessible. WordPress SEO will show a XML Sitemap button which you can click to view your sitemap_index.xml sitemap.

How to Tell Search Engines About Sitemaps?

Search engines are quite smart in finding a sitemap. Whenever you publish new content a ping is sent to Google and Bing to inform them about changes in your sitemap. However, we recommend that you submit your sitemap to Google by using Google Webmaster tools. The benefit of this is that Google will now show you any errors, pages indexed, and other relevant stats that will be helpful to you as a webmaster.

Go to Google Webmaster Tools. If you are not already signed in to your Google account, then you will be asked to sign in. After signing in you will reach webmaster tools. There you will see “Add a site” button, click it and then add the URL of your website.

On the next screen you will be asked to verify the ownership of the website you are trying to add. There are several methods to do that. But since you are already using WordPress SEO plugin, then the easiest method for you is to copy the HTML Meta tag value and paste it in WordPress SEO plugin. To do that click on Alternate methods and then on HTML Tag. You will then see a line of HTML Meta tag code.

Verify ownership of your website in Google Webmaster Tools with HTML Meta Tag

Copy and paste this line in a text editor like notepad. Now copy the value in the content=”” (Without copying the commas). Leave the webmaster tools site verification page open because we will come back to the page after adding the meta tag to verify the ownership of the website. Go to your WordPress admin area and then click on SEO tab. This will take you to WordPress SEO plugin’s dashboard. Scroll down, and you will see Webmaster Tools heading. Paste the meta tag value you copied next to Google Webmaster tools and Save Settings.

WordPress SEO Webmaster Tools

Go back to Google webmaster tools, site verification screen and press the verify button. You will see a notice like “Congratulations you have successfully verified your ownership of www.yoursite.com”. Click continue to see webmaster tools dashboard for your site.

On the next screen you will see Sitemaps column with no sitemaps in it. Clicking on it will take you to a Sitemaps page where you can add your sitemaps. Click on the red button labeled “Add/Test Sitemap” and provide the URL of your sitemap.

Adding your wordpress xml sitemap in Google webmaster tools

Yoasts WordPress SEO plugin publishes multiple sitemaps for your WordPress site. The main sitemap is sitemap_index.xml which contains link to your other sitemaps. You can either submit sitemap_index.xml alone or submit all other sitemaps one by one. We recommend submitting sitemap_index.xml alone, Google will then automatically discover other sitemaps and crawl them.

Once you have successfully added your sitemap, it will appear as pending. It will take Google sometime to crawl your website. After a while you would be able to see some stats about your sitemap. It will show you the number of links it found in your sitemap, how many of them got indexed, a ratio of images and web pages, etc.

A view of sitemap stats graph in google webmaster tools

Visit Google Webmaster tools often, at least once a month. As your site gets older you will start seeing more and more useful data about your website and how it is seen by the search engine. This information can help you learn how well your site is doing and what other things you can do to improve its performance in search engines.

We hope that it answered all the related questions like what is an XML sitemap, what are the benefits of a sitemap, how to create a sitemap in WordPress, and more. If you have any questions, or noticed that we missed something, then please leave a comment below.


Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Valentine says:

    Nothing to comment again because the process was straight forward. Thanks so much

  2. Toma says:

    First off, I`d like to say “thank you” for all your support and guidance to the new WP users.

    I`ve created a sitemap, however Google is telling me that the URL is restricted by robots.txt

    My robots.txt file look like this:

    User-agent: *
    Disallow: /

    Sitemap: http://www.example.com/sitemap.xml

    Checks:
    sitemap.xml has been tested and is working as expected.
    I`ve checked the site variants (www and non-www)
    I understand that in WP Admin, under Search Engine Visibility it is possible to encourage search engines to index the site. My understanding is that doing so will modify the robots.txt file and will allow all robots to crawl my site – including the “bad” crawlers (I`ve read this on other tutorials).

    Any further assistance will be greatly appreciated.

    Regards,

    Toma.

  3. danielsonjosh says:

    this is fabulous!!!!!! great work

  4. Abhinav says:

    The yoast sitemap page is showing “Warning: Class __PHP_Incomplete_Class has no unserializer in /home/content/n3pnexwpnas01_data02/78/3160178/html/wp-content/object-cache.php on line 520”, followed by url’s. This is the case with sitemap_index as well as sitemaps contained within. Sometime it shows right format and sometimes the similar error for the same post/page/index sitemap. How can I fix this?

  5. Quanglepro says:

    Hello,

    Your tip is very detail. But can i ask some more thing. I am new wordpresser from Viet Nam, I meet the problem with sitemap of Yoast seo.

    After Save changes the Sitemap of Yoast, Then i go to Google console to add ” sitemap_index.xml ” for index.

    After add sitemap_index.xml, It just show the blue color culumn, dont have any red color column for Index.

    It is PASS or FAIL? How can i know google console indexed my sitemap or Not index for this case.

    Nice day
    Quangle

    • WPBeginner Support says:

      If there is an error, Google will display the error. Otherwise you should see your sitemap accepted.

      • Quanglepro says:

        It is done sir. After 2 days, it will be indexed. Google doesnt index immediately.
        Nice day.

      • ArParvez says:

        dear sit iam seeing ur video and tutorial, using how to seo wordprees ytoast. i have done it, but when i try to see xml file it tell error/page not found but when i test this link on google sitemap it say no error found, but its empty. what should i do. and also i am getting problem using wordprees, i think i have done some mistake to install wp. i have install via Android phn.and sometime when i want to delete some plugin it tell error database,can u guys help me to reinstall wordprees pls it will be greatfull. tnx

  6. Alessio says:

    Hi guys,
    do I still need a dedicated plugin for the sitemap or does the latest version of WP come with something for the sitemap too?

  7. suji says:

    After installing Yoast plugin i got the below msg!

    The plugin Yoast SEO has been detected. Do you want to import its settings into All in One SEO Pack?

    wat do i need to do?

    • WPBeginner Support says:

      You need to disable All in One SEO plugin. Yoast SEO and All in One SEO are both SEO plugins. Having both of them enabled on your site may cause serious problems.

      • Suji says:

        Hi,

        Thanks for the reply. I disabled All in one SEO plugin. I have one more query. Can you pls answer it?

        I have already verified my site using HTML file upload method, so now how can i generate a sitemap using Yoast SEO plugin?

  8. Summer Breeze says:

    Thank you so much! This was immensely helpful.

  9. Jacqui Rawson says:

    Thanks guys!
    This was really helpful.
    You’re making my stress levels deflate immensely with all your assistance on getting my site all SEO set up.
    Cheers

  10. Emma says:

    Thank you for the step-by-step instructions – really helped me to understand WP and Google further.

    Keep up the good work!

  11. Abhyank says:

    “If you have a sitemap that is located on example.com/sitemap.xml, your sitemap is not being generated by our Yoast SEO plugin. It is probably generated by Google XML Sitemaps or another XML sitemaps plugin. Please disable other sitemap plugins and remove any sitemap files via FTP before enabling the sitemaps in our plugin.”

    How do i get around this?

    • WPBeginner Support says:

      Simply go to your plugins page. See if you have a plugin installed that adds XML sitemap. If you do, then disable that plugin.

      • Abhyank says:

        I really can’t figure out if any of my plugins are making a sitemap, i don’t think i have installed any that do. So terribly confused.

        • WPBeginner Support says:

          Then try disabling all plugins except Yoast SEO. Then try go to sitemaps, if you don’t see the message then this means one of the plugin was causing that. You can then activate plugins one by one and visit the sitemaps screen to see if the error reappears. Do that until you find the plugin causing it.

          On the other hand if you see the message even after deactivating all plugins, then it could be your WordPress theme or a manually created file on your server.

  12. Yuvraj Khavad says:

    Hello,
    Thanks for this tutorial.
    Very mush informative post.

    Thanks
    Yuvraj Khavad

  13. Dawit says:

    Thanks! very helpful.

  14. Erin says:

    Thank you for this informative article.
    I have notice that some of my pages are not included in the sitemap generated in WordPress using the Yoast SEO – XML sitemap tool. Is there a way to manually enter the missing pages or to update the sitemap to include these pages?

  15. Galib says:

    Really easy to follow and create a site map!!

  16. Jo says:

    Thank you! I think I have created what was needed and it was easy. Instructions were clear and easy to follow, thank you.

  17. Annika says:

    Hi there,
    I’ve read through a lot of pages trying to explain what you did, but seriously, yours is BY FAR the best. Easy to understand, one-by-one explanations. Thanks for your great help, you probably just saved me hours and hours of work.
    Cheers,
    Annika

  18. Magaly says:

    Great info, very useful! :)
    Now will wait for Google Analitycs to do his work :P

  19. Suraj says:

    Very helpful article n screenshots makes it easy to understand!! Thanks for posting!!

  20. kksilvery says:

    Hi,

    It was easy to understand. My question is , how can i edit my blog current sitemap?

    Regards,
    kksilvery.

  21. Kay Collier says:

    Thank you once again for more valuable information.

  22. Josh Watson says:

    SUPER useful article! I really appreciate the info! This saved me so much time and hassle. I had looked at a couple other guides and they were just confusing.

    I used this on my site and it really saved us!

  23. Shailesh Jangra says:

    Hi Syed Balkhi,

    Great post over sitemaps. I have one question for you.
    I have sitemap_index.xml for my website (without www ) but now I set my website to www version. I can see that all pages automatically changes with www version but sitemap_index dosn’t. Any specific reason.

    Also it shows nothing on but at sitemap_index.xml page I have complete sitemap.

    What is the mistake?

    • WPBeginner Support says:

      Since you have set your website URL on www your sitemap will be published on the same URL.

  24. zeeshan khan says:

    My site map shows the staticstics of web page but not show the staticstics of images. why not show image in my site map help me please.

  25. Tom Horn says:

    Whenever I submit the sitemap this is the message I get:

    “Your Sitemap does not contain any URLs. Please validate and resubmit your Sitemap.”

    Can you tell me what to do? Thanks.

  26. Leo says:

    I am having serious problems regarding sitemaps for a few months ago. I am using a wordpress hosted by godaddy. I’ve installed SEO by Yoast and did the sitemaps tutorial you had. Site’s is connecting, the sitemap is there, but the specific links (posts, pages, author, etc) are pending.

    We wait 48 hours, and none. We try it so many times, re-submitted, and yet Google search console is not crawling our site correctly.

    I don’t know what to do! Does it has to do with our theme? Godaddy told us there’s nothing blocking it on their side. And every time i look on the internet, many people are still having the same issue. Noticed that our site is working correctly and so are the feeds. But we are not crawling anything… Please if somebody already solved this, tell us, maybe someone else will going to solve this terrible issue

  27. Jess @ Make and Do Crew says:

    Thanks for this! It’s the clearest explanation I’ve seen. How long does it take for Google to crawl it? I can’t seem to get to that final visual you showed with the total number of pages and images indexed, although I haven’t gotten any sort of message that google is still working on it. Like, should I check back tomorrow? And if so, can you tell me exactly what to click on to find the confirmation that the site has been fully crawled? Thanks again!

  28. John says:

    Thanks for the info. As an addition: if the sitemap url gives a 404 then try lowering the default value of 1000 for the maximum number of lines. Worked for me.

    • Tamsin says:

      Thank you for your solution. I changed the default value to 200 and it works! I have spent the last week trying to get my head around this stuff being a complete beginner. You have saved my sanity.

  29. Israel says:

    please, after i clicked on the XML Sitemap

    what i got is error,

    Error 404 Not Found
    Oops! We couldn’t find this Page.

    Please check your URL or use the search form below.

    Please what can i do to get mu sitemp. thanks

  30. ramin ziafat says:

    thank you it was great

  31. surya teja says:

    thank you for the great article .

    i am having a problem . i am using free wordpress of name ( free domain sitename.wordpress.com ) i am not understanding how to add the site map at now

  32. Nitika says:

    nice article! apart from this do we need to enter google authorisation code?

  33. Leo says:

    Hi,

    Thank you so much for the easy-to-follow instructions and well explained topic about sitemaps.

    My question is How to add a ‘single’ page or post which displays all your posts. I hope you got what i mean.

    I saw a blog, at the bottom of the page there is a clickable link called ‘sitemap’. when you click it, it will bring you to a page containing all the published post or articles or i suppose, “the sitemaps”.

    How can i do these type of ‘clickable link’???

    Thank you very much.

  34. Naveen says:

    Nice article ! But when i submitted the sitemap, it is showing 0 url submitted at the dashbard area

  35. Kris letcher says:

    Thanks for the concise information.
    Kris

  36. Deb Slater says:

    Wow. wpbeginner is the very best instruction I have found for my WordPress site. Thank you.

  37. Harrison Okoyibo says:

    I just want to say a big “THANK YOU” for your efforts providing the internet wordpress users with useful, and relevant information, articles, and tutorials. Wishing you and your team more of God’s blessing. Shalom!

  38. Luigi says:

    Thank you for this tutorial! It was really helpful! :)

  39. Ana says:

    Thank you for your tutorial and info. It really helped me with the sitemap! Great job!

  40. Ezekiel says:

    Thank you for this explanation. I am indeed grateful for it.
    Your tutorials in this site has always been helpful

  41. Kaleem Ullah says:

    Your Sitemap appears to be an HTML page. Please use a supported sitemap format instead. need help

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.