2026年11月12日
2026年11月12日
Yoast SEO XML Sitemap Settings: Enable, Exclude and Submit to Search Console
This article is a localized edition of the Japanese original. Read the Japanese original
You turn on Yoast SEO's XML sitemaps with the "XML sitemaps" toggle under Yoast SEO → Settings → Site features in the admin area. Once it is on, a sitemap index is available at https://example.com/sitemap_index.xml, and that is the URL you submit to Google Search Console. Which pages appear in the sitemap is decided by each content type's "show in search results" setting.
This article follows the Yoast SEO (free) screens as of November 2026 and covers enabling the sitemap, deciding which pages to include, excluding individual items, checking the result, submitting to Search Console, and fixing a sitemap that does not appear.
How Yoast SEO XML sitemaps work
Yoast SEO sitemaps are not stored as files on the server; WordPress builds and returns them when they are requested. The structure is as follows.
| URL | Contents |
|---|---|
/sitemap_index.xml |
Index: a list of the sitemaps below |
/post-sitemap.xml |
Posts |
/page-sitemap.xml |
Pages |
/category-sitemap.xml |
Categories |
/author-sitemap.xml |
Author archives (only when they are set to be shown) |
Custom post types, tags and so on are added in the same format when they are set to show in search results. When a sitemap exceeds the number of entries it can hold, it is split, as in post-sitemap2.xml.
In Search Console, submitting the single index, sitemap_index.xml, is enough; you do not need to submit the individual sitemaps.
Step 1: Enable XML sitemaps
- In the admin area, open Yoast SEO → Settings.
- Choose Site features in the list on the left.
- Switch the "XML sitemaps" toggle on and click Save changes at the bottom of the screen.
- Use the link near the toggle that opens the sitemap ("View the XML sitemap") to confirm the index opens.
It is on by default. While it is on, Yoast SEO disables the WordPress core sitemap (/wp-sitemap.xml) and redirects it to the Yoast SEO sitemap. Conversely, turning Yoast SEO's sitemap off does not stop the core sitemap, so when you switch to another sitemap plugin, decide which one to use so you do not end up with two sitemaps.
Step 2: Decide which pages to include
Yoast SEO includes only pages that are set to show in search results in the sitemap. Anything set to noindex is left out automatically. You configure this in the list on the left of Yoast SEO → Settings.
| Target | Where | Setting |
|---|---|---|
| Posts, pages and custom post types | Each item under Content types | Turning "Show ... in search results" off removes that whole type from the sitemap |
| Categories, tags and other taxonomies | Each item under Categories & tags | Turning it off removes them as well. You can also choose whether to include terms without posts |
| Author and date archives | The "Author archives" and date archive items under Advanced | On a single-author site, hiding author archives is common |
| Media (attachment) pages | "Media pages" under Advanced | With media pages disabled (the default), they do not appear in the sitemap either |
Item names on the screen can differ slightly between versions and translations; the English screen names are given here.
If you want a custom post type such as shop products or events to show in search results, check that the item for that post type is turned on.
Excluding individual posts
To exclude posts one at a time, open the post in the editor, and in the Yoast SEO panel answer "Allow search engines to show this content in search results?" with "No", then update the post. The post becomes noindex and is also removed from the sitemap.
If you want to keep a post in search results but remove it from the sitemap only, specify it in code (next section).
Step 3: Exclude with code (functions.php, etc.)
You can adjust the sitemap contents with the filters documented in the Yoast SEO developer documentation. Put the code in your child theme's functions.php or in a plugin of your own.
<?php
// Remove specific post IDs from the sitemap (does not change how they are handled in search results)
add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', function () {
return array( 123, 456 );
} );
// Remove the custom post type product_review from the sitemap
add_filter( 'wpseo_sitemap_exclude_post_type', function ( $excluded, $post_type ) {
if ( 'product_review' === $post_type ) {
return true;
}
return $excluded;
}, 10, 2 );
// Remove the tag (post_tag) sitemap
add_filter( 'wpseo_sitemap_exclude_taxonomy', function ( $excluded, $taxonomy ) {
if ( 'post_tag' === $taxonomy ) {
return true;
}
return $excluded;
}, 10, 2 );
// Change the number of entries per sitemap
add_filter( 'wpseo_sitemap_entries_per_page', function () {
return 500;
} );
Replace product_review and the post IDs with your own. Pages set to noindex are removed automatically, so for pages you also want out of search results, excluding them with the Step 2 settings rather than code is easier to manage.
Step 4: Check the sitemap
Open https://example.com/sitemap_index.xml in a browser and check that the sitemaps you need are listed and that each sitemap contains the pages you want. To check from the command line:
# Does the sitemap index return 200? (an x-robots-tag: noindex, follow header is normal)
curl -sI https://example.com/sitemap_index.xml
# Extract the sitemap URLs listed in the index
curl -s https://example.com/sitemap_index.xml | grep -o '<loc>[^<]*</loc>'
# Is the Yoast SEO sitemap feature on? (1 means on)
wp option pluck wpseo enable_xml_sitemap
Yoast SEO adds an x-robots-tag: noindex, follow header to sitemaps. It keeps the sitemap itself out of search results and does not affect search engines reading the sitemap.
Step 5: Submit to Google Search Console
- Open Google Search Console and select your property.
- Choose Sitemaps in the left menu.
- Enter
sitemap_index.xmlunder "Add a new sitemap" and click Submit. For a URL-prefix property, the beginning of the URL is already shown, so enter only the rest. For a domain property, enter the full URL, such ashttps://example.com/sitemap_index.xml. - In the list of submitted sitemaps, confirm that the status is "Success" and that the number of discovered pages is shown.
Submitting once is enough. When you add or update posts, the sitemap contents change automatically and Google comes back to read submitted sitemaps again. If you see "Couldn't fetch", check the next section and then submit again.
When the sitemap does not appear or returns 404
Check the following from the top.
- Save permalinks again: Open Settings → Permalinks and click Save Changes without changing anything. The rewrite rules are rebuilt, which can fix a 404 on
sitemap_index.xml. - Is another sitemap overlapping? If another SEO plugin or sitemap plugin outputs a sitemap, the URLs collide. Keep only one. Also, if real files named
sitemap_index.xmlorsitemap.xmlexist on the server, they are served before WordPress gets the request. Check the public directory via FTP or similar, and delete any old files. - Caching: A page-cache plugin or CDN may have stored an old response or a 404. Clear the cache and open the sitemap again.
- Pages are missing: Check in the Step 2 table that the types you want are not set to not show in search results. For individual posts, check in the editor's Yoast SEO panel that they are not set to noindex.
- Site visibility: If "Discourage search engines from indexing this site" is checked under "Search engine visibility" in Settings → Reading, the whole site is noindex. Uncheck it on a live site.
Summary
- Enable XML sitemaps with "XML sitemaps" under Yoast SEO → Settings → Site features and check them at
/sitemap_index.xml. - Which pages are included is decided by the "show in search results" settings of each content type and taxonomy. Individual posts are removed when you set them to noindex in the editor.
- To remove items from the sitemap while keeping them in search results, use filters such as
wpseo_exclude_from_sitemap_by_post_ids. - Submit the index,
sitemap_index.xml, to Search Console once and confirm the status is "Success".
Related articles
References: Yoast SEO: XML sitemaps (Yoast help), XML sitemaps API (Yoast developer portal), Manage your sitemaps (Search Console Help)
Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)