Eric Nagel

Eric Nagel

CTO, PHP Programmer, Affiliate Marketer & IT Consultant

Image Sitemap for WordPress

I have been, or can be if you click on a link and make a purchase, compensated via a cash payment, gift, or something else of value for writing this post. Regardless, I only recommend products or services I use personally and believe will be good for my readers.

I was looking for a good image sitemap generator for WordPress, but of course found nothing really good. So, I wrote my own ๐Ÿ™‚

2011-01-14 Update: XML Image Sitemap is now available from

I’m still fascinated by image search results, and hope this will help me rank for some keywords (or at least understand things better)

  • Raj
    Posted October 26, 2010 2:45 pm 0Likes

    Thanks for this ๐Ÿ™‚

    • Eric Nagel
      Posted October 26, 2010 3:15 pm 0Likes

      My pleasure. Maybe I’ll re-release this as my first WordPress plugin ๐Ÿ™‚

  • Vicki
    Posted October 31, 2010 8:03 am 0Likes

    Do you know of an image sitemap generator for standard websites? I’ve found one that will specifically create an image sitemap but it doesn’t pick up the title of the image, only the location and filename. It picks up the filename and puts that in the title place. Please let me know if you know of a generator. Thanks.

    • Eric Nagel
      Posted October 31, 2010 8:13 am 0Likes

      Hi Vicki –

      That would be kind of difficult, as you wouldn’t know what page the image is on. However, I imagine you could write something that reads an “images” directory and then use the exif_read_data php function to read the comments. But, again, knowing what page that image is on is the hard part.

  • Steve @ 2008 Taxes
    Posted November 1, 2010 11:36 pm 0Likes

    Super cool stuff. I added the file to the site. I couldn’t get the xml extension to work but submitted the php extension and Google didn’t have any issues with it.

    • Eric Nagel
      Posted November 2, 2010 9:04 am 0Likes

      Yeah, I don’t think Google cares what the extension is. Now make sure you add titles to your images, so the “caption” is useful to the search engines (I see you’ve done this the past 2 posts)

  • soup
    Posted November 2, 2010 8:46 am 0Likes

    Hey man do you have an live example of how this should like like ?
    I tried this but do not think that it’s what i suppose to see right ?

    • Eric Nagel
      Posted November 2, 2010 9:02 am 0Likes


      Yeah, that’s it. View Source, and you’ll see some formatting. I’m working on a WordPress Plugin that’ll do all of this automatically, but I’m having trouble submitting it to I’ll get it up today, either here or on

  • Walter
    Posted December 15, 2010 6:34 pm 0Likes

    It’s the only image sitemap plugin that works for me.
    However the URLs are not “pretty”… I’m getting the default, ugly, wordpress urls like this:
    Do you know how to fix it?

    • Eric Nagel
      Posted December 16, 2010 8:24 am 0Likes

      Do you have your permalinks set right in your wordpress options?

  • Pushpinder Bagga
    Posted February 25, 2011 11:07 am 0Likes

    I also created a sitemap plugin recently – you can check it out here-

  • haris
    Posted April 27, 2011 10:09 am 0Likes

    after i submit the image sitemap to google webmaster tool used this plugin, i lost my index in google image, Do you know how to fix it? please

    • Eric Nagel
      Posted April 27, 2011 10:21 am 0Likes

      Start by using actual captions for your images. For example, you have:

      Change the caption to:
      Hayden Panettiere Wallpaper – hot!

      As for why Google dropped you from the Image results, it could be many things. If you think the sitemap is at fault, remove it from your Webmaster tools account. But, I’ve successfully used this on numerous sites and have images listed in the image search results.

  • Cor van Noorloos
    Posted April 27, 2011 3:16 pm 0Likes

    Hi Eric,

    It might be how it is suppose to work, but it seems when multiple posts are sharing the same image, only the first (date) post is listed as location

    • Cor van Noorloos
      Posted April 27, 2011 3:20 pm 0Likes

      Sorry, my mistake. It seems -looking at the media manager- this is simply how WordPress does things (:

      • Eric Nagel
        Posted April 27, 2011 3:23 pm 0Likes

        Yeah, an image will only be in the image sitemap once. You could always upload it twice, I suppose.

        • Cor van Noorloos
          Posted April 27, 2011 3:48 pm 0Likes

          Thanks Eric, for confirming this. This quick btw.! (:
          Thus far I’m completely liking your plugin.

          I’ve made one minor change though -not entirely sure if I can past code here.

          I’ve changed the post_title title to image:title instead of having both as image:caption.
          This way image:title shows if only the title has been submitted.

          Any chance including both in a perhaps future release?

          Meaning always showing the post title OR if different showing the image title (this is how the plugin currently works) AND if there showing the image caption.

          Sorry I can’t make myself not more clear. PHP doesn’t seems to be my native language (:

          • Eric Nagel
            Posted April 27, 2011 3:55 pm 0Likes

            I’ll review this – my latest post isn’t showing in the sitemap, so I wonder what’s stopping it.

            I struggled with showing the image caption, or title, or alt-text. Ideally, that’d be an option in the plugin, right?

            Version 2.0 ๐Ÿ™‚

  • Cor van Noorloos
    Posted April 27, 2011 4:05 pm 0Likes

    Kind of forgot there’s also an alt-text (: But currently the post title, image title and image caption just seems to work just right.

  • Fersy
    Posted April 30, 2011 2:53 am 0Likes

    hi eric,

    i’am use your plugin but only one picture was displayed??
    any idea?

    • Eric Nagel
      Posted April 30, 2011 8:28 am 0Likes

      The plugin uses images that were uploaded as Media using WordPress (when you create a post or page, and you click on the “Upload/Insert” Image, and get the pop-up to “Add media files from your computer”).

      Your site looks great, but it looks like you’re using some sort of plugin to handle your gallery. I’m guessing they’re just not stored properly in the WordPress database.

      • Fersy
        Posted April 30, 2011 8:41 am 0Likes

        hi eric,
        all my pictures using the wordpress media database..

        • Eric Nagel
          Posted April 30, 2011 8:56 am 0Likes

          Unfortunately, without access to your database, I can’t debug much more. Try running the SQL command:

          SELECT * FROM wp_posts
          WHERE post_type = ‘attachment’
          AND post_mime_type like ‘image%’
          ORDER BY post_date desc

          and see what comes back. The results must not have a post_parent of 0.

          I’m esnagel on Skype, if you want further help.

  • Fersy
    Posted April 30, 2011 9:06 am 0Likes


    the result:
    Zeige Datensรคtze 0 – 29 (1,235 insgesamt, die Abfrage dauerte 0.0034 sek.) [post_date: 2011-04-30 11:40:54 – 2011-04-29 21:46:45]

    1.235 pictures in database

  • Trackback: Search Engine Optimization – Basic SEO How To’s for Bloggers
  • Cor van Noorloos
    Posted May 12, 2011 5:57 pm 0Likes

    Hi Eric,

    In a future version perhaps, would it be possible to change $post->guid to something different php-ish? Sorry, databases aren’t really my language.

    $post->guid seems to be more an ID than a permalink, which could cause some difficulties when changing from website URL.

  • Trackback: Optimizing Images For A Wordpress Blog | Kevin Webster
  • Bern
    Posted May 17, 2011 3:06 pm 0Likes

    Good stuff man!
    I’ll definitely give this a shot on a couple of my sites.

  • Latest Tamil Cinema News
    Posted July 25, 2011 11:52 am 0Likes

    Just now downloaded the plugin. Seems to be good. Will post my opinion in some days.

  • Levent
    Posted October 3, 2011 11:17 am 0Likes

    Thank you for this plugin.I’m using this for 1 month and all my images indexed.Thanks

  • Trackback: Sell More Product With On Site Image SEO
  • Dennis
    Posted April 16, 2012 3:17 pm 0Likes

    Thank you very much for this Plugin! I was also looking for a XML Image Sitemap and didn’t found anything really good – so if you say that yours is better i count on you! ๐Ÿ˜‰

  • Mehndi Designs
    Posted August 4, 2012 3:45 pm 0Likes

    Thanks – i used it for images

  • fashionquest
    Posted August 16, 2012 9:53 am 0Likes

    Awesome plugin, thank you!

  • vinay
    Posted November 30, 2012 2:02 am 0Likes

    Thanks,i was looking for this….. Awesome plugin

  • Ashish Garg
    Posted January 21, 2013 5:39 am 0Likes

    Hi Eric Nagel I make image sitemap for my site but
    this is showing 3 images on one link

    See the Result

    and say what i do for show only one image par post

    • Eric Nagel
      Posted January 22, 2013 7:20 am 0Likes

      I’ll have to look at the code to see why you’re getting 3 images per post – it pulls from the WordPress Media library, but shouldn’t include an image more than once.

  • Cricketer
    Posted November 27, 2019 2:50 am 0Likes

    Could you share some light on whether image sitemaps by all sitemap generators pull images from WordPress’s media library regardless of whether they are used on a page or a post? (I currently use JetPack-generated sitemap, and its image sitemap, as also confirmed by their moderator on their support forum, pulls all images from the media library whether they are used in a post or on a page or not. I just wanted to learn/make sure if it is a normal behavior of a typical image sitemap or it is something I should worry about SEO-wise for example. Hoping to hear from you soon.

    • Eric Nagel
      Posted November 27, 2019 3:27 pm 0Likes

      Hi there – I can’t speak for all Image Sitemaps but I’m sure many only include images (media) that’s attached to a post or page.

      Note: I haven’t updated mine in some time.

Leave A Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.