Fixing OEmbed Thumbnail Image Size In WordPress

WordPress turned into an oEmbed provider in version 4.4. It would allow you to embed any WordPress post into another post / page. Great. So now if I’d paste the url of another WordPress post on my blog, it would looks like this:

Doesn’t it look great? Umm… Not really.

So what can we do about it?

By default WordPress oembed provider returns the image size of “thumbnail”, which is not all that hi-res as you can see in the above screenshot. To enable the “large” size to render, here’s the code that does the job:

add_filter('embed_thumbnail_image_size','my_oembed_img', 10, 2);

function my_oembed_img( $image_size, $thumbnail_id ){
    return 'large';
}

The result?

Doesn’t that look awesome?
Posted In:

WordPress Support & Maintenance, Code Snippets

Comment on Fixing OEmbed Thumbnail Image Size In WordPress

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