[Plugin: WordPress SEO by Yoast] Filter is duplicating the "og:image" tag?
-
I’m using one of Yoast’s filters to be able to override the built-in Image path tool for OpenGraph content. It works great, but I’m seeing a duplication of the (correct) OG tag in the page source. Any idea why? Is it a bug?
Here’s my code:
add_filter( 'wpseo_opengraph_image', 'tme_change_opengraph_image' ); function tme_change_opengraph_image( $og_image ) { // get some image data global $post; $yt_video_id = get_field('yt_video_id'); $video_id = getCustomField('video_id'); $post_thumb_ID = getCustomField('post_thumbnail_image'); $post_thumbnail_image_url = wp_get_attachment_image_src(get_post_meta($post->ID, 'post_thumbnail_image', true), 'medium'); if ($post_thumb_ID != "") { // if there's a thumb uploaded, do this if ($post_thumbnail_image_url[0] != "") { $fb_post_thumbnail = get_site_url().$post_thumbnail_image_url[0]; } } elseif ($video_id != "") { // no thumb, look for a video $fb_post_thumbnail = get_vid_img_src($video_id); } elseif ($yt_video_id !="") { // no thumb, not brightcove, YouTube? $fb_post_thumbnail = "http://i.ytimg.com/vi/".$yt_video_id."/hqdefault.jpg"; } else { // no thumbnail, no video...fall back to stock thumb $fb_post_thumbnail = get_site_url().get_template_directory_uri()."/img/fb_blog_stock.png"; } return $fb_post_thumbnail; }
- The topic ‘[Plugin: WordPress SEO by Yoast] Filter is duplicating the "og:image" tag?’ is closed to new replies.