Currently Available: Need a skilled Software Developer for your next project?
Categories
WordPress

Configuring Advanced Sitemap Controls in Yoast SEO

In WordPress, Yoast SEO creates an XML sitemap: a file that lists the site URLs Yoast recommends for search engines to find. Yoast groups those URLs into smaller sitemap files and lists those files in a sitemap index, a file that links to them. The settings control which content Yoast lists; they do not guarantee that a search engine will visit (crawl) a URL or add it to search results (index it).

You can control which URLs Yoast lists through its settings, an individual page’s search-visibility setting, or PHP filters for more specific rules. Choose the control that matches your goal: leaving a URL out of the sitemap does not, by itself, keep that page out of search results.

Confirm that Yoast controls the sitemap

In WordPress, open Yoast SEO → Settings → Site features and find XML sitemaps under Technical SEO. When the feature is enabled, use View the XML sitemap to open Yoast’s sitemap index. Your installation may use different menu names.

Yoast says enabling its sitemap feature automatically disables WordPress’s built-in sitemap. Turning off Yoast’s feature does not turn the WordPress sitemap back off, so another sitemap may remain available. If you find a sitemap at a different address, check which plugin or WordPress feature created it before changing settings. Yoast describes this interaction in its XML sitemap instructions.

Choose which content types appear

Under Yoast SEO → Settings, review Content types and Categories & tags. Yoast uses each type’s search-visibility setting to decide whether to list it in the sitemap. Content types and taxonomies, such as categories and tags, set to appear in search are included. Those removed from search are excluded. The sitemap customization settings describe this connection.

Include a content type or an archive page, which lists posts in a category or tag, when it has useful public pages that you want search engines to find. Exclude internal or duplicative content, and assess category, tag, and custom taxonomy archive pages individually. Some custom types do not appear in Yoast’s settings when their settings do not mark them as public. A developer may need to change those settings or use a filter.

Exclude one page with the right control

To remove an individual post or page through Yoast’s editor, open its Yoast SEO Advanced panel and set Allow search engines to show this content in search results to No. Update the page afterward. Yoast’s instructions for excluding content explain that this setting applies a noindex directive and removes the URL from the sitemap.

A noindex directive is an instruction that tells search engines not to show a page in search results. The search engine must still be able to crawl the page to read that directive. By contrast, sitemap exclusion alone only removes the URL from the sitemap; it does not instruct a search engine to stop indexing the page. Google also warns that blocking a URL in robots.txt does not reliably prevent it from appearing in search results. See Google’s technical requirements before using crawl restrictions to manage indexing.

If you want a page to remain eligible to appear in search results but leave it out of Yoast’s sitemap, the editor’s No setting is too broad because it also applies noindex. Use a developer filter for that narrower rule, and confirm that the filter matches your Yoast version and other site code.

Add specific rules with PHP filters

Yoast’s developer documentation provides filters for excluding post types and taxonomies. Other filters exclude individual posts and taxonomy terms. A filter is a PHP hook, a point where site code can change a value Yoast uses to create the sitemap. For example, this callback excludes a custom post type named internal_resource while preserving Yoast’s existing decision for other types:

add_filter(
    'wpseo_sitemap_exclude_post_type',
    function ( $excluded, $post_type ) {
        if ( $post_type === 'internal_resource' ) {
            return true;
        }

        return $excluded;
    },
    10,
    2
);

A similar rule can exclude a taxonomy:

add_filter(
    'wpseo_sitemap_exclude_taxonomy',
    function ( $excluded, $taxonomy ) {
        if ( $taxonomy === 'internal_topic' ) {
            return true;
        }

        return $excluded;
    },
    10,
    2
);

For specific posts, Yoast documents the wpseo_exclude_from_sitemap_by_post_ids filter. Replace the sample IDs with real post IDs from your site:

add_filter(
    'wpseo_exclude_from_sitemap_by_post_ids',
    function () {
        return [ 101, 205, 309 ];
    }
);

Treat these examples as starting points. Another plugin or theme can also alter sitemap output, so test changes on a staging site and check the generated sitemap before deploying them. Put site-specific code in a site plugin or child theme rather than editing a parent theme that could be replaced during an update. Yoast’s XML sitemap API documentation covers additional filters, including sitemap size, author exclusions, custom sitemaps, and image entries.

Change sitemap size only to solve a measured problem

Yoast’s customization documentation states that its default is 1,000 entries (URLs) per sitemap. It provides the wpseo_sitemap_entries_per_page filter to change that number. Google sets a separate maximum of 50,000 URLs or 50 MB uncompressed per sitemap file. Yoast’s default and Google’s maximum serve different purposes: one is Yoast’s default batch size, while the other is Google’s file limit. See Google’s guidance on building and submitting a sitemap.

Test a smaller sitemap file when you have evidence that Yoast has trouble creating or delivering the file. The cited documentation does not establish one ideal size for every WordPress site, nor does it show that changing the entry limit improves rankings. Measure the result rather than adjusting the limit as a general SEO tactic.

Check the generated sitemap

After changing a setting or deploying a filter, open Yoast’s sitemap index and follow its links to the relevant sitemap files. Confirm that the intended URLs appear and excluded URLs do not. For a page meant to stay out of search, also check that the page remains crawlable and returns the intended noindex directive.

Yoast says its sitemap updates as content changes. Google Search Console’s Sitemaps report can show whether Google processed a submitted sitemap and whether it reported errors. Sitemap submission helps with URL discovery, but Google treats it as a hint rather than a guarantee of crawling, indexing, or ranking.

Yoast’s real-time SEO analysis and sitemap controls handle separate tasks. Analysis provides feedback while you work on content; sitemap settings and filters determine which URLs Yoast lists. Changing analysis feedback does not, by itself, change sitemap eligibility.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Email updates

Usually a new article and a few links I found interesting.

No spam. Unsubscribe with one click.

Leave a Reply

Your email address will not be published. Required fields are marked *