How to Easily Add an XML Sitemap to WordPress

How do you add an XML sitemap to your site?

Like with all things WordPress, you use a plugin.

Two plugins stand above the rest, and I’ll provide an explanation of each so you can choose the right one for your site.

Yoast SEO

First, I have to suggest one of my favorite plugins, Yoast SEO.

Yoast SEO

Yoast SEO has had some controversial updates over the years, but the core product has always been excellent.

Why use Yoast SEO

Yoast SEO is a large plugin. If you want a quick and straightforward solution, or if you already have an SEO plugin, check out my next recommendation.

Otherwise, Yoast SEO is the best plugin for the job. In addition to handling sitemaps very well, it gives you a lot of control over your site’s SEO.

Did you know? Yoast SEO makes a ton of optimizations on your site automatically including proper pagination markup, canonicalization, and of course, adding sitemaps.

How to create a sitemap with Yoast SEO

Yoast enables the XML sitemap feature by default, and a sitemap is generated immediately upon installation.

Rather than creating one sitemap page, Yoast SEO creates a sitemap index. This is a page that links to a few XML sitemaps.

Here’s the settings page where you can enable/disable the various sitemaps.

Sitemap settings page

Yoast SEO XML sitemap example

Here’s the sitemap index for Compete Themes.

I only keep a sitemap for the posts, pages, and help articles (for theme documentation). I find taxonomies redundant since the three sitemaps alone cover all the content on the site. This gives the search engine bots fewer links to crawl.

Google XML Sitemaps

Another great option for adding an XML sitemap to your site is the Google XML Sitemap plugin.

Google XML Sitemaps

Before moving on, I want to point out that you can use this plugin for your sitemaps, and use Yoast SEO for other SEO features if you disable its sitemap feature.

Why use Google XML Sitemaps

Google XML Sitemaps is the highest-rated plugin of all time.

Like Yoast SEO, it automatically creates an XML sitemap index and updates dynamically as you publish new content. Google XML Sitemaps gives you more control over your sitemap’s configuration and also has options to “notify” search engines as new content is published.

How to create a sitemap with Google XML Sitemaps

Like Yoast SEO, all you have to do is install and activate the plugin.

Once activated, Google XML Sitemaps will create a sitemap index file linking to a variety of sitemaps. These sitemaps are constructed based on post types and dates. For instance, you’ll have a sitemap for each month for your posts as well as your pages.

The default configuration is probably best, but there are a lot of settings available to tweak your sitemaps.

Google XML Sitemaps settings menu

Create your XML sitemap yet?

While both plugins are excellent for adding sitemap functionality to WordPress, I prefer Yoast SEO. I already use it for other optimizations, and the sitemaps are well organized and efficient.

Adding a sitemap to your site is easy – it only takes as long as installing one of these plugins.

If you have any questions about these plugins or adding an XML sitemap to your site, please post a comment below.

Take our 7-day Email Course for FREE

You'll learn how to make your WordPress site look better, load faster, and make more money.

Invalid email address
You'll get one email a day for the next 7 days


  1. Okolie Anthony Okolie Anthony

    I have created the sitemap using yoast… when i submit it to google search console it tells me error that it is a html page… if i click on my xml sitemap from yoast it doest show as yours shows

    • Ben Sibley Ben Sibley

      Hi Okolie,

      Do you have W3 Total Cache active? There is a setting in it to block your sitemap from regular visitors that may cause this issue. I’d also recommend looking over Yoast’s list of fixes for common errors with the sitemap feature in their plugin.

  2. Andrew Foster Andrew Foster

    Yes, Yoast SEO plugin is best for creating XML sitemap in wordpress website. I always used this plugin to generate and after it i submit that sitemap to webmasters. Anyways, thanks for this great post.

  3. Suzy Turnbull Suzy Turnbull

    Hi there,
    I signed up to Ubersuggest that told me I do not have a sitemap on my website, which is very odd because not only does Yoast (free version) show me that I do have an XML sitemap, but I have also submitted a sitemap to the Google Search Console. So naturally I am totally confused and would like some thoughts and advice as to what to do next. Thank you so much.

    • Ben Sibley Ben Sibley

      If Yoast SEO and Google are both saying they found your sitemap then I think it’s safe to assume this is a bug in Ubersuggest. Neil Patel recently purchased Ubersuggest and had it re-built from the ground up so it’s not unreasonable for it to have a bug like this as a relatively new tool.

Comments are closed.

Disclosure: This post may contain affiliate links. Purchasing a product through one of these links generates a commission for us at no additional expense to you.