Add itemprop=”image” to all WordPress images

VN:F [1.9.22_1171]
Rating: 4.7/5 (36 votes cast)

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

VN:F [1.9.22_1171]
Rating: 4.7/5 (36 votes cast)
VN:F [1.9.22_1171]
Rating: +7 (from 11 votes)
Add itemprop="image" to all WordPress images, 4.7 out of 5 based on 36 ratings

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 *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>