Use a Resized Image for Yoast SEO’s og:image tag

A came across an issue with my site, the images used in Yoast SEO‘s og:image tag was too large for my twitter card. This was because I upload full sizes photos as my featured photos in WordPress.

Fixing this was just as simple as adding this snippet to your theme’s functions.php

function sc_opengraph_image_size() {
return "large";
}
add_filter('wpseo_opengraph_image_size','sc_opengraph_image_size',10,1);

This basically tells Yoast SEO to only use large images in the open graph tags generated.

And remember to always test your social images in Twitter’s Card Validator and Facebook’s URL Debugger.

fdeae153de513e0c36d152f0ec71b953KKKKKKKKKKKKKKKKKKKKKKKKKKKK