2

I would like to add image tags into my sitemap posts:

<image:image>
<image:loc>
<![CDATA[ https://example.com/image.jpg ]]>
</image:loc>
<image:caption>
<![CDATA[ Image caption  ]]>
</image:caption>
<image:title>
<![CDATA[ Image Title ]]>
</image:title>
</image:image>

Is there any filter that allows to add these tags into a native WP sitemap?

Thank you

4
  • 1
    In the Make WP Core blogpost about adding sitemaps this is discussed under "Adding Additional Tags to Sitemap Entries" - have you tried any of these filters already? – kero Feb 9 at 15:13
  • I have edited my answer because I realized that the 'wp_sitemaps_posts_entry' filter ony allows to edit loc and lastmod: Fields other than %s are not currently supported for the sitemap index – retroriff Feb 10 at 14:15
  • So it is not possible with the methods described there? – kero Feb 10 at 14:19
  • I have not been able to achieve it. I found the message above in class-wp-sitemaps-renderer.php. These are the allowed fields: 'loc', 'lastmod', 'changefreq', 'priority'. – retroriff Feb 11 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.