An XML sitemap is a file that lists the URLs on your website that you want search engines to crawl and index. Think of it as a roadmap for Google, Bing, and other search engines. Without a sitemap, search engines rely entirely on following links to discover your pages, which means some content might never get indexed. For WordPress sites with hundreds or thousands of pages, a well-configured sitemap can make a significant difference in how quickly and completely your content appears in search results.
The Built-in WordPress Sitemap (Version 5.5+)
Since WordPress 5.5, every WordPress installation automatically generates an XML sitemap at /wp-sitemap.xml. You do not need to install anything for this to work. The built-in sitemap includes posts, pages, custom post types, categories, tags, and author archives.
However, the built-in sitemap has some notable limitations:
- No
lastmoddate: It does not include the date each URL was last modified, which search engines use to decide whether they need to re-crawl a page. - No
priorityorchangefreqtags: You cannot tell search engines which pages are most important or how often they change. (Google has said it largely ignores these, but Bing still uses them.) - Limited control over inclusion and exclusion: There is no settings page to choose which post types, taxonomies, or specific pages to include or exclude. You need to use PHP filters to customize it.
- No image or video sitemaps: The built-in sitemap only lists page URLs. It does not generate separate sitemaps for images or videos, which can help with Google Image Search and Video Search rankings.
- No news sitemap support: If you run a news site, you need a dedicated news sitemap that follows Google News requirements, and the built-in sitemap does not support this format.
For a small site with a few dozen pages, the built-in sitemap is often sufficient. For larger sites or sites that need more control, a plugin is the better choice.
Setting Up a Sitemap with Yoast SEO
Yoast SEO is one of the most popular WordPress SEO plugins, and it generates a comprehensive XML sitemap with features the built-in sitemap lacks:
- Install and activate the Yoast SEO plugin from the WordPress plugin directory.
- Go to Yoast SEO → Settings → Site features.
- Ensure that XML sitemaps is toggled on.
- Your sitemap will be available at
/sitemap_index.xml.
Yoast automatically splits your sitemap into sub-sitemaps for posts, pages, categories, tags, and other content types. Each sub-sitemap contains up to 1,000 URLs. Yoast also includes lastmod dates and lets you exclude specific post types, taxonomies, or individual pages from the sitemap through its settings and per-page SEO controls.
One advantage of Yoast is that it automatically pings search engines when you publish or update content, so they know to re-crawl your sitemap.
Setting Up a Sitemap with Rank Math
Rank Math is another feature-rich SEO plugin that provides excellent sitemap functionality:
- Install and activate Rank Math from the plugin directory.
- Go to Rank Math → Sitemap Settings.
- On the General tab, configure the maximum number of URLs per sitemap (default is 200).
- Switch between the Posts, Pages, and Taxonomies tabs to control which content types are included.
- Your sitemap will be at
/sitemap_index.xml.
Rank Math also supports image sitemaps out of the box. It scans your posts for images and includes them in the sitemap, which can improve your visibility in Google Image Search. You can exclude specific posts or pages using the per-page Rank Math controls in the editor.
Dedicated Sitemap Plugins
If you already have an SEO plugin that does not include sitemap functionality, or if you prefer to keep things separate, there are dedicated sitemap plugins available. The XML Sitemaps plugin (formerly Google XML Sitemaps) has been around for years and is widely used. It generates a standard sitemap with full control over which content types to include, URL priority, and change frequency.
Another option is Google XML Sitemap Generator, which is lightweight and focused purely on sitemap generation without bundling additional SEO features.
What to Include and Exclude from Your Sitemap
Not every URL on your site belongs in the sitemap. Here are some guidelines:
- Include: Published posts, pages, and custom post types that contain unique, valuable content. Landing pages, product pages, and cornerstone content should always be included.
- Include: Important category and tag archive pages, especially if they have custom descriptions and serve as useful content hubs.
- Exclude: Pages with a
noindexmeta tag. Adding a page to your sitemap while telling search engines not to index it sends mixed signals. - Exclude: Thin content pages like author archives (on single-author sites), date-based archives, and search result pages.
- Exclude: Duplicate content, paginated pages beyond page 1, and utility pages like the login page, privacy policy (unless you want it indexed), and thank-you pages.
- Exclude: Media attachment pages (WordPress creates a separate page for every uploaded image by default). These are almost always thin content.
Sitemap Index Files for Large Sites
The XML sitemap specification limits each sitemap file to 50,000 URLs and 50 MB in size. For sites with more than a few thousand pages, you should use a sitemap index file. This is an XML file that lists multiple individual sitemap files, each containing a subset of your URLs.
Both Yoast SEO and Rank Math handle this automatically. They create a sitemap index at /sitemap_index.xml that links to sub-sitemaps like /post-sitemap.xml, /page-sitemap.xml, /category-sitemap.xml, and so on. Each sub-sitemap stays well within the size limits.
Image and Video Sitemaps
Standard XML sitemaps only list page URLs. If your site relies heavily on visual content, consider adding image sitemaps. These sitemaps include information about images on each page (URL, caption, title, license), which helps Google index them for Image Search.
For sites with video content, a video sitemap provides Google with metadata about your videos (title, description, thumbnail URL, duration, upload date). This can lead to video rich snippets in search results, which tend to get higher click-through rates.
Rank Math includes image sitemap support by default. For video sitemaps, you typically need Yoast SEO Premium with the Video SEO add-on, or a dedicated video sitemap plugin.
News Sitemaps
If your site publishes time-sensitive news content and you want to appear in Google News, you need a news sitemap. News sitemaps follow a specific format that includes the publication name, language, and publication date. Only articles published within the last 48 hours should appear in a news sitemap.
Yoast SEO offers a News SEO add-on for this purpose. Rank Math also includes news sitemap support in its pro version.
Submitting Your Sitemap to Search Engines
Creating a sitemap is only half the job. You also need to tell search engines where to find it:
- Add the sitemap URL to your robots.txt file: This is the simplest method. Add a line like
Sitemap: https://example.com/sitemap_index.xmlat the end of yourrobots.txtfile. Search engines check this file regularly and will discover your sitemap automatically. - Submit through Google Search Console: Log in to Google Search Console, select your property, go to Sitemaps in the left sidebar, enter your sitemap URL, and click Submit. Google will show you the status and any errors it finds.
- Submit through Bing Webmaster Tools: Log in to Bing Webmaster Tools, go to Sitemaps, and submit your sitemap URL. Bing also lets you submit individual URLs for faster indexing.
After submitting, check back in a few days to see the indexing status. Google Search Console shows how many URLs were submitted, how many were indexed, and whether any errors occurred (like 404 pages or redirects in your sitemap).
Disable the Default WordPress Sitemap
If you use a plugin to generate your sitemap, you should disable the built-in WordPress sitemap to avoid having two competing sitemaps. Add this line to your theme's functions.php or a site-specific plugin:
add_filter('wp_sitemaps_enabled', '__return_false');Most SEO plugins like Yoast and Rank Math handle this automatically when they detect their own sitemap is active, but it does not hurt to be explicit about it.
Verify with InspectWP
Run an InspectWP scan on your site to verify that your sitemap is properly configured and accessible. The SEO section of the report shows whether a sitemap was found, which URL it is located at, and whether it is referenced in your robots.txt file. If InspectWP does not detect a sitemap, make sure the URL is correct and that your sitemap is not blocked by robots.txt rules or server-side access restrictions.