Search engines cannot index content they cannot discover. A WordPress XML sitemap is the roadmap you hand directly to Google, Bing, and other search engines — a structured file listing every page, post, and content type on the site with optional metadata about update frequency and priority. Without one, search engines discover content only by following links, which means recently published posts, pages with few inbound links, and category archives may never be crawled. This guide covers creating, submitting, and troubleshooting a WordPress XML sitemap from scratch. You’ll find the complete rundown in our Complete Guide to WordPress How.
WordPress XML Sitemap — What It Is and Why It Matters
A WordPress XML sitemap is a file, typically found at yoursite.com/sitemap.xml or yoursite.com/sitemap_index.xml, that lists all the URLs on the site in a format search engines read directly. Unlike an HTML sitemap for human visitors, the XML sitemap is purely for crawler consumption — it tells search engines what exists on the site, when it was last modified, and optionally how important each URL is relative to others.
Modern WordPress (version 5.5+) generates a basic WordPress XML sitemap automatically without any plugin. Navigate to yoursite.com/wp-sitemap.xml — if WordPress is installed and running, this URL returns an XML sitemap index containing links to individual sitemaps for posts, pages, categories, tags, and authors. The built-in sitemap is functional but minimal — it includes all published content but omits priority values, change frequency hints, and image metadata that SEO plugins add. For most sites, the built-in sitemap is sufficient for basic search engine discoverability. For sites with complex content structures, WooCommerce products, or specific SEO requirements, an SEO plugin’s sitemap provides the additional control needed.
The primary SEO benefit of a WordPress XML sitemap is not ranking improvement — sitemaps do not directly influence rankings. Their value is in ensuring complete crawl coverage: Google reports crawling URLs discovered in sitemaps 2–3x faster than URLs discovered only through link following. For large sites with hundreds of posts, for sites with thin internal linking, and for newly launched sites with no inbound links yet, a sitemap is the most direct way to get all content indexed promptly. According to Google’s Search Central documentation, sitemaps are especially valuable for large sites (over 500 pages) and new sites, where the crawler may not otherwise discover all content through link following alone.
Generating a WordPress XML Sitemap With an SEO Plugin
The two most widely used SEO plugins — Rank Math and Yoast SEO — both generate comprehensive WordPress XML sitemaps with significantly more configuration options than WordPress’s built-in sitemap. If either is already active on the site, the SEO plugin’s sitemap replaces the built-in one automatically.
Enable the Rank Math sitemap: Rank Math → Sitemap Settings → toggle “Sitemap Index” On → configure which post types and taxonomies to include → save. Rank Math generates a sitemap index at /sitemap_index.xml with separate child sitemaps per content type. Enable “Include Images” to include image metadata in the sitemap — this helps image search indexing. Set the “Links per Sitemap” to 1000–5000 depending on site size. Rank Math also supports news sitemaps (for Google News) and video sitemaps for sites with video content, both accessible through the Sitemap Settings panel.
Yoast SEO sitemap configuration: Yoast → General → Features → XML Sitemaps → toggle On. Navigate to Yoast → Search Appearance → Content Types → for each post type, set “Show in search results” to Yes if it should be included in the WordPress XML sitemap. Yoast generates its sitemap at /sitemap_index.xml with child sitemaps for each included content type. The Yoast sitemap also automatically excludes noindex posts and pages from the sitemap — posts marked “noindex” in Yoast’s post-level settings are not listed in the sitemap, which is the correct SEO behaviour since sitemap inclusion and search indexation should be consistent. Our guide on fixing WordPress admin dashboard performance covers the plugin management approach that applies when multiple active plugins create sitemap conflicts by each trying to generate their own sitemap at the same URL.
Submitting Your WordPress XML Sitemap to Search Engines
Generating the WordPress XML sitemap is only the first step — submitting it to search engines ensures they are aware of it immediately rather than discovering it when they happen to crawl robots.txt. Both Google Search Console and Bing Webmaster Tools accept sitemap submissions.
Submit to Google Search Console: navigate to search.google.com/search-console → select the property → left sidebar → Indexing → Sitemaps → enter the sitemap URL (typically sitemap_index.xml) → Submit. Google verifies the sitemap is reachable, parses it, and begins crawling the listed URLs. The Sitemaps report in Search Console shows how many URLs Google discovered in the sitemap, how many have been indexed, and any errors encountered during sitemap processing. Check this report regularly after submission — errors listed here (unreachable URLs, malformed XML, blocked by robots.txt) prevent those URLs from being indexed even though they appear in the sitemap.
Ping search engines automatically by adding the sitemap URL to robots.txt. Add this line to the root robots.txt file: Sitemap: https://yoursite.com/sitemap_index.xml. Search engine crawlers read robots.txt on every visit to a site and use the Sitemap directive to discover the WordPress XML sitemap without requiring manual resubmission after site changes. Yoast SEO and Rank Math both add this line to robots.txt automatically when their sitemap is enabled — verify it is present by navigating to yoursite.com/robots.txt. If the sitemap line is missing from robots.txt, add it manually through the SEO plugin’s Tools section (Rank Math → General Settings → Edit robots.txt; Yoast → Tools → File Editor).
Fixing WordPress XML Sitemap Errors
A WordPress XML sitemap that exists but returns errors — in Google Search Console, in the browser, or when validated — prevents search engines from using it correctly. Each error type has a direct fix.
“Sitemap could not be read” in Google Search Console means the sitemap URL returned a non-200 HTTP status (404, 500, or redirect) when Google attempted to fetch it. Navigate to the sitemap URL directly in the browser to confirm it is accessible. A 404 means the sitemap has not been generated or the plugin that generates it is deactivated. A 500 means a PHP error occurs when the sitemap is generated — enable debug logging and check /wp-content/debug.log for the specific error. A redirect means the sitemap URL redirects to a different URL — update the sitemap URL in Search Console to the final destination URL after the redirect. “Sitemap not found” after the plugin is active usually means a permalink flush is needed: Settings → Permalinks → Save Changes → the sitemap rewrite rules are regenerated.
XML parsing errors in the WordPress XML sitemap — visible when opening the sitemap URL in a browser that shows “This page contains the following errors” — indicate malformed XML in the sitemap output. The most common cause is a PHP notice or warning being output before the XML declaration. Enable WP_DEBUG temporarily → reload the sitemap URL → the PHP notice appears at the top of the sitemap, identifying the plugin or theme code generating the invalid output. Fixing or disabling the code that generates the PHP notice restores the valid XML sitemap. Validate the corrected sitemap at a sitemap validation service to confirm the XML is well-formed before resubmitting to Search Console. Our guide on fixing WordPress 404 errors covers the permalink flush and rewrite rule regeneration that resolves sitemap 404 errors alongside general WordPress URL resolution problems.
Excluding Content and Managing Large Sitemaps
A WordPress XML sitemap should include only content that is publicly accessible, indexed, and of genuine value to search engine visitors. Including URLs for tag archives with one post, author archives for non-publishing accounts, or paginated views of the same content dilutes the sitemap’s signal and wastes crawl budget on low-value URLs.
Configure exclusions from the WordPress XML sitemap in Rank Math: Rank Math → Sitemap Settings → select each content type → toggle off any type that should not appear in the sitemap (e.g., custom post types used for internal data management, media attachments, private post types). For individual post exclusion, edit the post → Rank Math sidebar panel → Advanced → “Exclude from Sitemap” toggle. Yoast SEO exclusion follows the same pattern: Yoast’s search appearance settings per content type, and the “noindex” toggle in each post’s Yoast meta box simultaneously removes the post from the sitemap and marks it noindex — ensuring consistency between sitemap inclusion and indexation intent.
Large sites generate WordPress XML sitemap files that would be too large as a single file. The sitemap index format solves this: the index file at /sitemap_index.xml lists child sitemap files (post-sitemap.xml, page-sitemap.xml, category-sitemap.xml) each containing up to the configured URL limit (typically 1000–5000 URLs). Google’s limit is 50,000 URLs per sitemap file and 50MB uncompressed — most WordPress sites are well within these limits. For sites approaching these limits, enable sitemap compression (both Rank Math and Yoast support gzip compression of sitemap files) to reduce file size. Search engines accept gzip-compressed sitemaps and the file size reduction improves sitemap fetch speed for very large sites. After any sitemap structure change — adding a new post type, changing the URL limit per file, enabling compression — resubmit the sitemap index URL in Google Search Console to ensure Google uses the updated structure.
Monitoring the WordPress XML sitemap after submission reveals indexation gaps that need attention. Google Search Console’s Sitemaps report shows “Discovered URLs” (listed in sitemap) versus “Indexed URLs” (actually in Google’s index). A large gap between the two numbers — where 500 URLs are in the sitemap but only 200 are indexed — indicates that Google is aware of the content but has decided not to index it. Common reasons: thin content on pages Google considers low-quality, duplicate content being consolidated to canonical versions, or pages that load too slowly for Google’s crawl budget to prioritise. The Coverage report in Search Console categorises each URL’s status with a reason, providing specific guidance for improving the indexed-to-discovered ratio over time.
For WooCommerce stores, the WordPress XML sitemap should include product pages and exclude internal pages like cart, checkout, and my-account. Rank Math automatically detects WooCommerce and provides a “Product” sitemap option in its Sitemap Settings. Verify the WooCommerce pages (cart, checkout, account) are excluded — these have canonicals pointing to themselves but should not be indexed by search engines. In Yoast: Search Appearance → WooCommerce → ensure Shop Page, Product Categories, and Products are set to “Show in search results: Yes” while Cart, Checkout, and Account pages are excluded. A correctly configured WooCommerce WordPress XML sitemap has a direct impact on how quickly new product listings are discovered and indexed by Google, reducing the typical discovery delay from weeks to days for product pages on established sites. Our guide on setting up Google Analytics on WordPress covers Search Console integration that combines with sitemap data to provide complete visibility into how search engines discover and index the site’s content.
Image sitemaps are an extension of the standard WordPress XML sitemap that lists images associated with each URL, enabling image search indexing in addition to standard web search indexing. Rank Math and Yoast both include image data in their sitemaps when “Include Images” is enabled in the sitemap settings. The image sitemap entries include the image URL, caption, title, and license URL — providing Google Image Search with the metadata needed to properly attribute and rank images in image search results. For photography sites, food blogs, product-heavy ecommerce stores, and any site where image traffic is a significant traffic source, enabling image inclusion in the sitemap directly improves image search visibility. Verify image inclusion by checking the sitemap XML for <image:image> tags within the URL entries — their presence confirms image metadata is being included correctly.
Automating WordPress XML sitemap resubmission after major content changes ensures Google is always working from the most current sitemap version. WordPress itself pings Google when new posts are published (via the built-in update_services function), but this only triggers for new posts — not for bulk updates, category restructuring, or post deletions that change the sitemap structure. The IndexNow protocol, supported by Bing and increasingly by Google, allows instant notification of URL changes via a simple API call. Rank Math includes IndexNow support — enable it in Rank Math → General Settings → Instant Indexing → configure the IndexNow API key. Every time a post is published, updated, or deleted, Rank Math pings IndexNow automatically, ensuring the WordPress XML sitemap and the search engine’s index stay synchronised without manual intervention.
A caching plugin that caches the WordPress XML sitemap serves a stale version to search engine crawlers when new content is published — Google sees the old sitemap and misses recently published posts for days or weeks. Configure the caching plugin to exclude the sitemap URLs from caching: in WP Rocket, add /sitemap_index.xml and /.*-sitemap.xml to the “Never Cache These Pages” list under Advanced Rules. In LiteSpeed Cache, add the same URLs to the Exclude URI list. Dynamic sitemap generation by Rank Math or Yoast is fast enough that caching provides no meaningful performance benefit, and the staleness cost far outweighs any server load saving. Always keep the WordPress XML sitemap URLs excluded from page caching on any site where search engine discoverability of new content is a priority.






