Hi, folks
minor issue with latest version of theme; where a duplicate open graph image tag is being inserted into the head, which should not be there when using a separate SEO plugin.
In header.php, lines 17-26 seem to be the culprit, and are not needed for those running something like YOAST SEO, which already inserts og:image tag:
//facebook sharing fix for videos, we add the custom meta data
if (is_single()) {
global $post;
if (has_post_thumbnail($post->ID)) {
$td_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
if (!empty($td_image[0])) {
echo '<meta property="og:image" content="' . $td_image[0] . '" />';
}
}
}
This is the only code I could find with quick search which may be the culprit of adding duplicate og:image tag above the YOAST SEO (or other) plugin section. I would presume the query is dropping in an echo, regardless of whether it’s a video or not (in my case no videos at this time).
I will go so far as call this a bug, since it’s not an optional choice. I am going to try removing that block and see if it fixes issue. More later.
Hi,
@Christopher thanks for sharing!
Sorry for the delay. We have this on our todo list, we will look into it and fix it in the next theme update. Mean while you can remove the code Christopher pointed from the header this will also remove the og: tag.
Sorry for this!
Thanks
@Christopher and @Lucian, can I still delete lines 17-26 in header.php to solve this issue? I am running 6.2.3 (the lastest version as of today I believe) and its duplicating the og:image tag in the header before YOASTS SEO
Or has the code changed that I’d want to remove?
Thanks
So I found out where its now on 6.2.3:
/wp-content/themes/Newspaper/includes/wp_booster/td_wp_booster_functions.php on 276-281
// facebook sharing fix for videos, we add the custom meta data
if (has_post_thumbnail($post->ID)) {
$td_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
if (!empty($td_image[0])) {
echo '<meta property="og:image" content="' . $td_image[0] . '" />';
}
}
Can I safely remove it?
Chris, is this facebook sharing fix for videos not an issue because we are running YOAST (I’m running free version)?
Ideally l’d like the og:image tag to not be duplicated AND be able to post videos without issues on fb.
Ok, so I commented it out and it looks like it fixed it…Please confirm though Chris if you can about using YOAST to solve the sharing fix they are describing
Also, is this is right way to comment out lines 276-281? http://screencast.com/t/3sbbdNEl2U
Hi,
Yes you can remove it if you use a plugin(Seo by Yoast) to add og: data – http://screencast.com/t/uCgo8sIUV
Thanks!
-
This reply was modified 10 years by
Alin [tagDiv].
