How to Create a Sitemap for a WordPress Site

What a sitemap is and why it matters
An XML sitemap is a file containing a list of all pages on your site that you want search engines to index. Think of it as a map of your site you hand to Google, Bing, and other search engines so they can more easily find and understand your content structure. Without a sitemap, search engines have to rely entirely on following links to discover your pages, which can mean some pages are never indexed.
A sitemap is especially important for new sites that don't have many inbound links, sites with a large number of pages (over 500), sites with a complex structure where some pages aren't well connected by internal links, and sites that frequently add new content like blogs and e-commerce stores. Google explicitly recommends using a sitemap as part of basic SEO practice.
Sitemap types
XML Sitemap
The XML sitemap is the standard format search engines understand. It contains page URLs along with metadata such as last modified date (lastmod), change frequency (changefreq), and page priority (priority). WordPress sites typically have a sitemap index that references multiple individual sitemap files - one for posts, one for pages, one for categories, etc. This is especially useful for large sites because a single sitemap file can contain a maximum of 50,000 URLs.
HTML Sitemap
An HTML sitemap is a page on your site intended for human visitors, not search engines. It displays an organized list of all important pages with links. Although not a direct SEO factor, it helps users find content and improves user experience. Many sites have an HTML sitemap page in the footer.
Video and Image Sitemap
If your site contains a lot of video content or images, separate sitemaps for media files help search engines index them. A video sitemap contains information about duration, category, and video description. An image sitemap helps Google Images better index your images, which can drive significant traffic, especially for e-commerce and portfolio sites.
WordPress built-in sitemap
Since version 5.5, WordPress has built-in XML sitemap support without the need for an additional plugin. The built-in sitemap is available at yoursite.com/wp-sitemap.xml and automatically includes posts, pages, categories, and tags. However, the built-in WordPress sitemap has limited customization - you can't easily exclude specific pages, add priorities, or control which content types to include. For most sites, a SEO plugin with advanced sitemap features is a better choice.
Creating a sitemap with Yoast SEO
Installation and activation
Yoast SEO is the most popular WordPress SEO plugin with over 5 million active installations. After installation and activation, sitemap functionality is automatically enabled. Your sitemap will be available at yoursite.com/sitemap_index.xml. Yoast automatically generates a sitemap index containing links to individual sitemap files for each content type.
Configuring sitemap in Yoast
In WordPress admin go to Yoast SEO → Settings → Site features → APIs. Verify that the XML sitemaps option is enabled. Then, for each content type (posts, pages, custom post types) you can configure whether it's included in the sitemap. If you have content types that shouldn't be indexed (like private pages or ad landing pages), exclude them from the sitemap. Yoast also automatically adds images to the sitemap, which helps index visual content.
Excluding individual pages
To exclude a specific page from the sitemap, open that page in the editor, find the Yoast SEO meta box at the bottom, and in the Advanced tab set "Allow search engines to show this page in search results?" to "No". This will both set a noindex tag and remove the page from the sitemap. Use this for thank-you pages, pages with duplicate content, or any pages you don't want in search.
Creating a sitemap with Rank Math
Basic setup
Rank Math is a newer SEO plugin that is rapidly growing in popularity thanks to rich free features. The sitemap is configured through Rank Math → Sitemap Settings. Rank Math offers more detailed control than Yoast in the free version - you can set the number of links per sitemap page, include or exclude images, and control every content type individually.
Advanced options
Rank Math allows adding external pages to the sitemap (pages that aren't WordPress posts or pages), excluding specific posts and pages by ID, priority and changefreq settings for every content type, automatic search engine pinging when the sitemap is updated, and special sitemaps for local businesses (Local SEO sitemap) and video content (Video Sitemap in the Pro version). These advanced options make Rank Math an excellent choice for sites with specific SEO needs.
Manually creating a sitemap
Creating the XML file
If you don't want to use a plugin, you can manually create an XML sitemap. Create a sitemap.xml file in your site's root directory. The file must start with an XML declaration and use the urlset namespace. Each URL is defined inside a url tag with a required loc element (page URL) and optional lastmod (last modified date), changefreq (daily, weekly, monthly), and priority (0.0 to 1.0) elements. A manual sitemap requires manual updates every time you add or change a page, which makes it impractical for active sites.
Online sitemap generators
If you have a small static site, you can use online tools like XML-Sitemaps.com, Screaming Frog, or Sitemap Generator that automatically crawl your site and generate an XML sitemap. These tools are useful for a one-time sitemap generation, but for WordPress sites that are regularly updated, a plugin solution is far more practical because it automatically updates the sitemap with every content change.
Submitting the sitemap to Google Search Console
Adding the site to GSC
Google Search Console (GSC) is a free Google tool for tracking your site's presence in Google search. If you don't have a GSC account yet, create one at search.google.com/search-console. Add your domain using a Domain property (recommended), which covers all URL variants, or URL prefix property for a specific version. Verify ownership through a DNS record (for Domain property) or HTML tag, file, or Google Analytics (for URL prefix).
Submitting the sitemap
In GSC go to Sitemaps in the left menu. Enter the URL of your sitemap (usually sitemap_index.xml or sitemap.xml) and click Submit. Google will start processing your sitemap and will show status - successfully read URLs, errors, and warnings. Pay attention to any errors like URLs returning a 404 status or pages blocked by robots.txt.
Tracking indexing status
After submitting the sitemap, follow the Coverage report in GSC, which shows how many pages are indexed, how many have errors, and how many are excluded. The most common errors are: "Submitted URL has crawl issue" (the page can't be crawled), "Submitted URL marked noindex" (the page has a noindex tag but is in the sitemap), and "Submitted URL seems to be a Soft 404" (the page exists but has no content). Resolve errors regularly because accumulated errors can negatively affect crawl budget.
Sitemap optimization
What to include in the sitemap
Include all pages you want indexed and that provide value to users: published posts and pages with quality content, categories and tags with enough content, custom post types (products, portfolio items), and canonical URLs. Don't include pages with thin content, duplicate pages, pages with a noindex tag, private pages, and admin URLs.
Regular updates
The sitemap should always be up to date. SEO plugins like Yoast and Rank Math automatically update the sitemap when you publish a new post or modify an existing one. Periodically check that the sitemap doesn't contain URLs that return errors (404, 500) or redirects (301, 302). Use a tool like Screaming Frog to crawl your sitemap and identify problem URLs.
Common sitemap mistakes
- Including noindex pages: If a page has a noindex tag but is in the sitemap, Google reports an error. Always sync noindex settings with the sitemap.
- Outdated URLs: Deleted or moved pages that remain in the sitemap generate 404 errors in GSC. Clean the sitemap regularly.
- Sitemap too large: A sitemap with more than 50,000 URLs or larger than 50MB must be split into smaller files with a sitemap index.
- Blocking the sitemap in robots.txt: Verify that robots.txt doesn't block access to your sitemap file. Add a Sitemap: directive to robots.txt.
- Not using HTTPS URLs: If you use HTTPS with an active certificate, all URLs in the sitemap must be HTTPS versions.
Conclusion
A sitemap is a simple but powerful tool that helps search engines efficiently crawl and index your site. For the WordPress CMS, we recommend using the Yoast SEO or Rank Math plugin, which automatically generates and updates the sitemap. After creation, be sure to submit the sitemap to Google Search Console and regularly track the indexing status. At BeoHosting, all WordPress hosting plans come with the Yoast SEO plugin pre-installed and an automatically generated sitemap, so your site is visible to search engines from day one.
BeoHosting Team
10+ years of experience — Web hosting and infrastructure specialists
- Web Hosting
- WordPress Hosting
- VPS
- Dedicated Serveri
- Domeni
- SSL
- cPanel
- LiteSpeed
- Linux administracija
- DNS
Last updated: