Adding schema itemprop image to the_post_thumbnail with filters

You’ve simply the wrong arguments (incl. the list of them).

$caption, $title, $align, $url, $alt

are too much in there.

And $attr is missing. Not that it matters how you name the vars (as long as they start with a character), but it’s easier to read for later readers.

function wpse76536_image_schema( $html, $post_id, $post_thumbnail_id, $size, $attr ) 
{
    return "<div class="image-container" itemprop='image'>{$html}</div>";
}
add_filter( 'post_thumbnail_html', 'wpse76536_image_schema', 10, 5 );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)