Anchors in WordPress not followed/ indexed in sitemap.xml

Google does not index anchor tags, only URLs. (Note that by anchor tags, I assume you mean a URL like site.com/page.html#anchor)

The solution is to create a separate, static URL that displays the same content as what you would get with the anchor tag – for instance site.com/page-anchor.html.

Then you can just create a page with links to all these new URLs, and Google will follow those links nearly as efficiently as with a sitemap file. Or manually edit a sitemap.xml file and upload it to your server for Google to index.