Hello @jaguar54
Thanks for reaching out about your attachment sitemap. Disabling Media pages in WordPress > Yoast SEO > Settings > Advanced > Media pages removes the attachment sitemap. Since this doesn’t remove the first attachment sitemap URL, this is indeed strange behaviour. Please try the following steps:
- Toggle the button to turn OFF and ON the sitemap feature in WordPress Yoast SEO > Settings > General > Site Features > APIs > Sitemap.
- Without making any changes, resave the permalink settings in WordPress > Settings > Permalinks
If this doesn’t make any difference, perform a conflict check as instructed here.
Do let us know how it goes.
OK, so I have been through your suggestions – no difference.
I installed Health Check & Troubleshooting. While in Troubleshooting mode with just Yoast activated, the rogue attachments_sitemap disappeared. Back out of Troubleshooting it has reappeared. Presumably this indicates that one of the other plugins is causing the issue. I will proceed with enabling one additional plugin at a time until the rogue sitemap reappears.
I also installed WP Healthcheck, which detected remnants of AIOSEO in WordPress startup files. I used that tool to remove them but the problem remains. Incidentally, I experimented with AIOSEO around the time that the rogue sitemap is dated. It was not as good as Yoast and so I de-installed it and switched back to Yoast. I expect something in this process has caused the sitemap problem.
That was an interesting exercise…
Troubleshooting enabled – Yoast enabled (basic posts and pages sitemaps)
All other plugins enabled one by one with check of sitemaps each time – all as it should be
Astra theme enabled – no problems
Troubleshooting mode disabled – sitemaps correct (no rogue sitemap). According to Yoast – Site features – View the XML Sitemap
However, I deleted the sitemap_index in Google Search Console, then re-submitted sitemap_index using https://sitename/sitemap_index.xml. The rogue attachments sitemap was still present.
So now, Yoast doesn’t see the rogue sitemap (it did previously), but it is still present!
SOLUTION:
I browsed the database manually. It showed a number of residual tables from both Rank Math and AIOSEO which I experimented with before reverting to YoastSEO (because it turned out to be better than the rest!).
I used WP-Optimize to delete those tables, if only to clear the clutter, and now there is no sign of the old attachments_sitemap which must have been lurking in those redundant tables. Shame on you Rank Math and AIOSEO for not cleaning up behind yourselves.