Fix Your Sitemap for WordPress

Updated April 2026·By SitemapFixer Team

WordPress sitemap issues come from four plugin options, overlapping defaults, and custom post types that nobody remembers creating. This guide walks through Yoast, Rank Math, All-in-One SEO, and the WordPress core sitemap - and when to use each.

Analyze your WordPress sitemap nowTry Sitemap Fixer Free

WordPress core added a built-in sitemap at /wp-sitemap.xml in version 5.5 (2020). It's basic but functional. Most real sites still run Yoast, Rank Math, or All-in-One SEO because those plugins expose per-type exclusions, image sitemaps, and integration with the rest of the SEO config. If you have two of them installed at once, you'll have conflicting sitemaps and Google will crawl both. Pick one.

Saw a WP agency site with 180 real blog posts. Yoast sitemap showed 4,200 URLs. The reason: an old "Documentation" custom post type from a plugin they'd deactivated (but not deleted) still had 3,900 orphaned posts in the database, and Yoast was happily listing them. Deleting the post type via WP-CLI cleared it instantly.

Plugin comparison

Common WordPress Sitemap Issues

Attachment pages - the silent bloater

Every image uploaded to WordPress gets its own URL like /attachment/photo-name/. By default these are indexable, and on a site with years of media uploads you can have thousands of them. Yoast disables them via: SEO > Search Appearance > Media > "Redirect attachment URLs to the attachment itself" = Yes. Rank Math: Titles & Meta > Media > Redirect Attachments to Parent = On.

Excluding custom post types

// Core sitemap: exclude a post type
add_filter('wp_sitemaps_post_types', function ($post_types) {
    unset($post_types['product_variation']);
    unset($post_types['acf-field']);
    return $post_types;
});

// Core sitemap: exclude specific posts
add_filter('wp_sitemaps_posts_query_args', function ($args, $post_type) {
    if ($post_type === 'post') {
        $args['post__not_in'] = [123, 456];
    }
    return $args;
}, 10, 2);

// Yoast: exclude a post type entirely
add_filter('wpseo_sitemap_exclude_post_type', function ($excluded, $post_type) {
    if ($post_type === 'attachment') return true;
    return $excluded;
}, 10, 2);

WooCommerce quirks

WooCommerce registers product_variation as a public post type, which can leak variation URLs into core and some plugin sitemaps. Also: ?orderby=popularity, ?filter_color=red, and /page/2/ on shop archives. Add robots.txt rules for the parameters, and use the filter above to drop product_variation.

Multisite

On a multisite network, each site has its own sitemap. Subdomain multisites: site1.example.com/sitemap_index.xml. Subdirectory: example.com/site1/sitemap_index.xml. Each subsite should be a separate property in GSC. Don't build a "network sitemap" that combines them - GSC treats them as separate domains anyway, and you lose per-site coverage data.

Step-by-Step Fix Guide

  1. Pick one SEO plugin (Yoast, Rank Math, or AIOSEO). Deactivate and delete any others
  2. In that plugin, toggle off taxonomy archives with thin content (tags with <5 posts)
  3. Disable author archives if only 1-2 authors have published
  4. Turn on "Redirect attachment URLs to the attachment itself"
  5. Audit custom post types via WP-CLI: wp post-type list. Remove orphans.
  6. For WooCommerce, exclude product_variation and block filter parameters in robots.txt
  7. Clear Yoast/Rank Math sitemap cache (Tools > Clear sitemap cache or wp rewrite flush)
  8. Verify with curl https://yoursite.com/sitemap_index.xml and spot-check URLs
  9. Submit the sitemap index (not individual sub-sitemaps) to Google Search Console

Frequently Asked Questions

Yoast vs Rank Math vs All-in-One SEO vs WordPress core - which sitemap?
WordPress core (5.5+) ships a basic sitemap. Yoast and Rank Math both produce richer sitemaps with image entries, per-type splits, and exclude toggles. Rank Math's UI is better for technical users; Yoast has more third-party compatibility. Pick one - don't run two SEO plugins simultaneously.
Does WordPress multisite have per-site sitemaps?
Yes, each site in a multisite network generates its own sitemap. Don't try to combine them into a network-wide sitemap - submit each site separately in GSC.
How do I exclude custom post types from the WordPress sitemap?
In Yoast: SEO > Search Appearance > Content Types. In Rank Math: Titles & Meta > [Post Type]. With core only, use the wp_sitemaps_post_types filter.
Analyze your WordPress sitemap
Find all issues in your sitemap - free, no credit card needed
Analyze My Sitemap Free
Other platform guides