Image Sitemap for WordPress

by on October 26, 2010

Pin It

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 WordPress.org

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

Was this post useful? Please share it with others:

Pin It

{ 32 comments… read them below or add one }

Raj October 26, 2010 at 2:45 pm

Thanks for this :)

Reply

Eric Nagel October 26, 2010 at 3:15 pm

My pleasure. Maybe I’ll re-release this as my first WordPress plugin :)

Reply

Vicki October 31, 2010 at 8:03 am

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.

Reply

Eric Nagel October 31, 2010 at 8:13 am

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.

Reply

Steve @ 2008 Taxes November 1, 2010 at 11:36 pm

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

Reply

Eric Nagel November 2, 2010 at 9:04 am

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)

Reply

soup November 2, 2010 at 8:46 am

Hey man do you have an live example of how this should like like ?
I tried this http://www.ericnagel.com/sitemap-image.xml but do not think that it’s what i suppose to see right ?

Reply

Eric Nagel November 2, 2010 at 9:02 am

Hi,

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 WordPress.org. I’ll get it up today, either here or on WordPress.org

Reply

Walter December 15, 2010 at 6:34 pm

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: http://www.domain.com/?p=253
Do you know how to fix it?

Reply

Eric Nagel December 16, 2010 at 8:24 am

Do you have your permalinks set right in your wordpress options? domain.com/wp-admin/options-permalink.php

Reply

Pushpinder Bagga February 25, 2011 at 11:07 am

I also created a sitemap plugin recently – you can check it out here- http://www.pushpinderbagga.com/google-xml-image-sitemap-generator-plugin-for-wordpress/439/

Reply

haris April 27, 2011 at 10:09 am

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

Reply

Eric Nagel April 27, 2011 at 10:21 am

Start by using actual captions for your images. For example, you have:
hayden-panettiere-wallpaper-hot

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.

Reply

Cor van Noorloos April 27, 2011 at 3:16 pm

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

Reply

Cor van Noorloos April 27, 2011 at 3:20 pm

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

Reply

Eric Nagel April 27, 2011 at 3:23 pm

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

Reply

Cor van Noorloos April 27, 2011 at 3:48 pm

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 (:

Reply

Eric Nagel April 27, 2011 at 3:55 pm

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 April 27, 2011 at 4:05 pm

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.

Reply

Fersy April 30, 2011 at 2:53 am

hi eric,

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

http://www.spreephoto.de/sitemap-image.xml

Reply

Eric Nagel April 30, 2011 at 8:28 am

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.

Reply

Fersy April 30, 2011 at 8:41 am

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

Reply

Eric Nagel April 30, 2011 at 8:56 am

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.

Reply

Fersy April 30, 2011 at 9:06 am

@eric

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

Reply

Cor van Noorloos May 12, 2011 at 5:57 pm

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.

Reply

Eric Nagel May 13, 2011 at 11:44 am

Hello,

guid converts to something like
http://www.ericnagel.com/wp-content/uploads/2011/05/50dollar.jpg

it’s the URL of the image, not an ID

Reply

Cor van Noorloos May 13, 2011 at 12:13 pm
Eric Nagel May 13, 2011 at 12:48 pm

What are you using to move the image? guid is a value from the database. I’m sure if you move / rename the image with FTP, the database value will be wrong, and nothing will work. So… don’t do that.

Reply

Bern May 17, 2011 at 3:06 pm

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

Reply

Latest Tamil Cinema News July 25, 2011 at 11:52 am

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

Reply

Levent October 3, 2011 at 11:17 am

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

Reply

Dennis April 16, 2012 at 3:17 pm

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! ;)

Reply

Leave a Comment

{ 3 trackbacks }

Previous post:

Next post: