I am looking into the correct way of adding schema.org to the images of all my posts. I am already using a plugin (wpprop) which is adding schema to the header, blogpost, comment section, and other areas, but I particularly want some code to add in the theme for media files in single posts and attachment posts.
I have tried adding =image
in functions.php
but this does not work anymore; it is showing an error in the Google structure data tool.
Here is the code, I found it on a WordPress site:
add_filter( 'works_secondary-image_thumbnail_html', 'mediaboxlv_image_', 10, 3 );
function mediaboxlv_image_( $html, $post_id, $post_image_id {
$htmlstr_replace( 'src', ' src', $html );
return $html;
}