Ability To Toggle og:image ….

Posted in: Newspaper
Post count: 4

Anyway you guys could add the ability to toggle

function hook_wp_head() {
if (is_single()) {
global $post;

// 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] . ‘” />’;
}
}

on or off in the theme panel?

I haven’t been able to figure out how to child theme it out and every update I have to manually go in and just delete <meta property=”og:image” content=”‘ . $td_image[0] . ‘” /> manually.

I have tried using yoast but the above snippet always overrides what I set in yoast and as a result what gets shared via fb share button is the feature image instead of our customized fb image.

Post count: 20688

I will add this on our list and the developer team will consider it, but I could not give you an estimate or say for sure when it will be looked over.

Post count: 11

Hi Simion,

This issue is more serious than it seems at first. Facebook will use the first og:image tag that it encounters. Your functionality is overriding Yoast and therefore rending the wrong image for every post. In a previous post in 2018, someone from your team mentioned that you leave this functionality to other plugins, not sure why that has changed but it does more damage at this point than good.

Thanks.

Post count: 20688

Hi,


@Julia
white Unfortunately there were no changes made in that regard, sorry for the inconvenience. This is included in our to do list and it will eventually be looked at.

Thanks

Post count: 9

Agreed. Most people have Yoast SEO, and this code breaks its functionality.

Post count: 5

Hi, did you manage to fix the video post sharing to FB problem (picking wrong image)

I’ve searched to implement your supposed fix to test it, but i can’t find where to put it nor delete the meta you are refering to.

Thanks in advice

Post count: 20688

Hi,


@Novanet
The code referred to above is here – https://www.screencast.com/t/Iwl8siN49J
It outputs a meta image which may interfere with the sharing, when you use a different image for Facebook share in Yoast settings.

A quick fix would be to remove that code from the theme files until a solution is found in the matter on our side. Sorry again for the inconvenience.

Thanks

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newspaper’ is closed to new topics and replies.