Your WordPress Sitemap Is Lying to Google — Here's the 5-Minute Audit That Proves It
A client called me last month because half their site had vanished from Google. Search Console showed "Discovered — currently not indexed" climbing every week, and their sitemap report looked fine: 400 URLs submitted, no errors.
So I opened the sitemap and actually read it. Ninety of those URLs redirected somewhere else. Forty were pages the site had set to noindex. Twelve still pointed at the old staging domain from a migration six months earlier.
The sitemap loaded. It validated. It was also lying — and Google had stopped trusting it.
A sitemap is a promise. Every URL in it says: this page is real, it is indexable, and it is worth your crawl. Break that promise often enough and Google stops believing the file, which is exactly when your new pages stop getting discovered. Here is the audit I run on every client site, and the three lies it keeps catching.
1. First, make sure you are reading the right sitemap
WordPress has more than one sitemap, and most "sitemap not working" reports start here:
| Source | Default URL |
|---|---|
| WordPress core (no SEO plugin) | /wp-sitemap.xml |
| Yoast SEO / Rank Math | /sitemap_index.xml |
| All in One SEO | /sitemap.xml |
If you switched SEO plugins at some point, you probably have two sitemaps live right now — core's and the plugin's — disagreeing with each other. Pick one owner and turn the other off. When Rank Math or Yoast owns the sitemap, disable the core one:
// Turn off the WordPress core sitemap when your SEO plugin owns it. add_filter( 'wp_sitemaps_enabled', '__return_false' ); Then check Search Console → Sitemaps and confirm the submitted URL is the one you just fixed. The file Google has on record is the one that matters, not the one you happen to open in your browser.
2. The 5-minute audit: ask every URL what it really returns
A sitemap lists URLs. It never tells you what those URLs do. This loop does:
# Count how many sitemap URLs return each status code for url in $(curl -s https://yoursite.com/post-sitemap.xml | grep -oP '(?<=<loc>)[^<]+'); do curl -s -o /dev/null -w '%{http_code}\n' "$url" done | sort | uniq -c On a healthy site, that output is one line: every URL returning 200. On the client site I described, it came back as 258 × 200, 90 × 301, 40 × 200-with-noindex, and 12 × 404. Then list the offenders:
# Print every sitemap URL that does NOT return 200 for url in $(curl -s https://yoursite.com/post-sitemap.xml | grep -oP '(?<=<loc>)[^<]+'); do code=$(curl -s -o /dev/null -w '%{http_code}' "$url") [ "$code" != "200" ] && echo "$code $url" done Repeat it for each child sitemap in the index (posts, pages, products, categories). Five minutes, no plugin, and you now know exactly which promises your sitemap is breaking. A quick spot-check for the noindex half of the problem:
curl -s https://yoursite.com/some-page/ | grep -i 'noindex' \ && echo "noindexed — this URL should not be in the sitemap" 3. The three lies I find most often
Lie one: redirects in the sitemap. After a redesign or a URL restructure, the old URLs stay listed while the new ones are missing — or both are listed. Google follows the redirect, lands on the destination, and notes that the sitemap pointed at a URL that no longer exists. List the destination, never the redirecting URL. The same goes for the trailing-slash twin and the http/https twin: one canonical version only.
Lie two: noindexed pages in the sitemap. Tag archives, thank-you pages, cart and checkout, login and account pages — set to noindex by the SEO plugin, then listed in the sitemap anyway. That is a direct contradiction: one signal says "index this", the other says "don't". Search Console flags it as "Submitted URL marked 'noindex'", and each one chips away at how much Google trusts the rest of the file. A good plugin removes noindexed pages automatically; if yours doesn't, exclude those post types and taxonomies in its sitemap settings.
Lie three: staging URLs after a migration. The site moves from staging.client.com to the live domain, the Site Address changes, and the sitemap cache keeps serving the old domain for weeks. I have seen sitemaps that were half staging URLs six months after launch. After every migration: purge every cache layer, re-save permalinks (or wp rewrite flush --hard from the terminal), and re-open the sitemap logged out to confirm the live domain is in every <loc>.
4. Two traps the guides skip
The cache trap. A page cache or CDN serving a stale copy of the sitemap is why new posts "don't appear in the sitemap" on so many sites. Exclude sitemap*.xml from page caching entirely — a sitemap is generated on the fly and caching it only freezes old data. And if Search Console says "Couldn't fetch" while the sitemap opens fine in your browser, the problem is almost never WordPress: it is a firewall or Cloudflare bot rule treating Googlebot as a bot. Check that robots.txt doesn't block the sitemap itself, and that bot-challenge protection exempts Googlebot.
The lastmod trap. Google ignores priority and changefreq completely. It does use lastmod — but only when the date is honest. Plugins that stamp every URL with today's date teach Google to ignore the field, which is the opposite of what you want when you publish something new. A correct lastmod changes only when the page actually changed.
5. What a clean sitemap looks like
- Only canonical URLs, each returning 200, each indexable
- No redirects, no 404s, no noindexed pages, no parameter or tracking variants
- No staging URLs, no thin archives, no utility pages (cart, checkout, thank-you)
- Honest
lastmod, one sitemap owner, submitted once in Search Console - Under 50,000 URLs or 50 MB per file, split with a sitemap index above that
Then read the Sitemaps report the way Google does: submitted URLs versus indexed URLs. On an 80-page brochure site, a clean sitemap is 60–90 URLs. If yours lists 400 on a site with 300 indexed pages, most of it is being declined — trim it, then fix the pages that are left.
A sitemap never makes Google index anything. It is a list of URLs you are willing to stand behind. Keep that list honest and Google leans on it; fill it with redirects and dead pages and Google learns to ignore it — along with the new pages you actually care about.
I'm Taha Khan, Founder & CEO at Web Vision Expert in Karachi, where I build WordPress and WooCommerce sites for small businesses — sitemaps are one step in the pre-launch checklist I actually run on client sites.
Which of these have you found on a client site? The staging URLs surviving a migration is my most frequent — I'd be curious what tops your list.