Support » Plugin: Yoast SEO » 2 Bugs with Images in Sitemap

  • Resolved michaelxxx



    I´m a user of Yoast for many many years… I think more than 15 years now 🙂

    At the moment I work on a redesign on localhost and I think about to upgrade to the Pro Version. But before I do this I like to report a bug I found in the sitemap. I have a travel blog with thousands of photos. So it´s very important for me to add all images into the sitemap. This works perfectly with YOAST sitemap. All my images have unique title tags, descriptions and alt tags – BUT – when I download and open the yoast sitemap in XML I found 2 bugs:

    1) when I include an image in a post with a gallery shortcode, the title tag is not listed in your sitemap. Caption is ok, but the title fields are empty. Other sitemaps have the title tag of all images in the sitemap. Is this a bug in Yoast?

    2) You can see in the attached screenshot that the sitemap counts 26 images for the post “http://localhost/puerto-rico/carnival-valor-karibikkreuzfahrt” – But the post has only 13 images?! So all images where added twice in the sitemap. You can see this in the XML file. What can be the reason for this?

    I hope you can take a quick look at this and let me know what we can do.

    I wish you a merry Christmas 🙂

    Screenshot of Sitemap

Viewing 7 replies - 1 through 7 (of 7 total)
  • Saša


    Did you use Gutenberg, Classic editor or something else?

    1. I’m not sure is it bug. I’ll try to check. HTML parser extracts title from img tag (in post_content), but gallery parser get attachments (by IDs) directly from database. It could explain difference.

    2. It’s an issue. If you have same image in the content more than once then it’ll be duplicated in sitemaps. You can see more details on github –

    Yoast works on “indexables” (and big refactoring the code). It’s possible that new releases will fix your issues.

    Thread Starter michaelxxx



    I use the Classic Editor 🙂

    1. Is there anything I can do to help you with that?

    2. The images are shown twice in my sitemap are not included multiple times in my post. I just use the gallery shortcode like [gallery ids="7172,7173,7174,7175"] and Justified Image Grid. At the bottom of the topic “Do not add duplicate images from a post to the sitemap” is the notice “It should be easy fix”. So it isn´t?

    Plugin Support Pcosta88



    We would like some more information.

    1. Can you confirm you are using the most recent Yoast SEO, v12.7.1? If you update, does the issue resolve?

    2. Can you confirm you are using WordPress 5.3.2? You can check by clicking on the W in the top left and selecting About. If you need to update, please check with your host provider. Please know that if you are using an older version of WordPress Core you may experience unexpected behavior with Yoast. This guide explains more:

    3. Are all your non-Yoast plugins and themes also updated?

    4. How is the gallery shortcodes being outputted? By a plugin or some other method? If a plugin, which one and can you provide a link to it? Is it a free plugin or a paid plugin?

    5. Are you using a pagebuilder like WPBakery, Elementor, SiteOrigin or Divi etc. to add the images? If so, which one and what modules?

    Thread Starter michaelxxx



    here are my answers:

    1) Yes, I´m using Version 12.7.1

    2) Yes, I´m using WordPress 5.3.2

    3) Yes, all my plugins are updated.

    4) I just use a gallery shortcode like [gallery ids="7172,7173,7174,7175"] and the premium plugin “Justified Image Grid” to display the gallery.

    5) No, I´m not using a pagebuilder. I work with the Classic Editor.

    Plugin Support amboutwe


    As we don’t have access to the premium plugin “Justified Image Grid”, I tested with everything else mentioned and the images are picked up from the gallery shortcode in classic editor.

    This likely means that the premium “Justified Image Grid” plugin changes the way images are processed and since we don’t have access to test it further, the best advice I can recommend is to contact the “Justified Image Grid” support team for further troubleshooting.



    I also wasn’t able to reproduce your issues. Based on your comments, I think that the plugin “Justified Image Grid” uses the filter wpseo_sitemap_urlimages to override/add images into the sitemap. You could try to locate this filter in their source and temporary remove it. If you see differences then I could try to create PHP snippet which uses array_unique (or something similar) which removes duplicates.

    Plugin Support Md Mazedul Islam Khan


    This thread has been marked as resolved due to a lack of activity. You’re always welcome to re-open this topic.

    Thanks for understanding!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘2 Bugs with Images in Sitemap’ is closed to new replies.