[Plugin: WordPress SEO by Yoast] Using Featured Image's Thumbnail for Facebook's og:image
-
WordPress version: 3.4.2
WordPress SEO version: 4.2.7I did this: Assigned a Featured Image to a post
I expected the plugin to do this: Use ‘Thumbnail’ of the Featured Image as the og:image value (Default: 150 x 150 Cropped, changed to 200 x 200 Cropped)
Instead it did this: Used ‘Medium’ of the Featured Image (300 x 300, not cropped).
Now that that’s out of the way.
By default, this plugin will use the Medium version of a post’s featured image. This is fine, but there is no option to tell it to use a) thumbnail (that can be set in Settings > Media) or b) a custom image size set up in the theme’s functions.php file. This would be a nice addition for a future release. In the meantime, to manually change to using ‘thumbnail’ or ‘my-custom-facebook-thumbnail’ sizes:Adjust ‘medium’ to the desired thumbnail size on line 155 of class-opengraph.php found under:
frontend > class-opengraph.php
From:
$featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), apply_filters( 'wpseo_opengraph_image_size', 'medium' ) );
To:
$featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), apply_filters( 'wpseo_opengraph_image_size', 'thumbnail' ) );
That is all.
- The topic ‘[Plugin: WordPress SEO by Yoast] Using Featured Image's Thumbnail for Facebook's og:image’ is closed to new replies.