Add itemprop=”image” to all WordPress images

Working with Schema.org documentation, found that (almost?) all images use same attribute itemprop=”image”, so why not add it to all images.

Now You can download as plugin: Itemprop WP

! New way to add itemprop=”image” by using different WordPress filter wp_get_attachment_image_attributes

Here is my solution:

Script snippet: adding itemprop=”image”

Explanation

On first row we add new filter to picture’s HTML output. Since we don’t care about other attributes, we simple grab must used attribute – src – and add to it itemprop=”image”.

… and search engines (Google, Yahoo, …) will love You more (because they support microdata, like schema.org)

PS. just don’t forget to correctly markup rest of code :)

Look! Already 6 responses to Add itemprop=”image” to all WordPress images

Roselle

#4444

hey, thanks for your plugin.

I installed it, but how do I know that it’s working?

Thanks,
Roselle

Rolands Umbrovskis

#4451

Well, You can check source :)

Roselle

#27360

Hi there,
when I check the page source, I don’t see any itemprops anywhere..

thanks,
roselle

SEO

#11258

This shows only in source code. But still missing the following:

hatom-feed
hatom-entry:
Warning: At least one field must be set for HatomEntry.
Warning: Missing required field “entry-title”.
Warning: Missing required field “updated”.
Warning: Missing required hCard “author”.

Rolands Umbrovskis

#11313

Hi, SEO!
This Your error code is not related to plugin, it’s error of Your WordPress theme.

You provided microformat data, but plugin is using microdata if schema.org

Azmi

#28007

Hi, nice code and well implemented on WP. What about video, can we do the same? thanks

Leave a Reply

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