Hello,
When I share a blog post for example on Facebook the Featured Image I have included in the blog post does not show. Instead, my Logo shows. I investigated this and was told by Facebook’s Debug Tool that –
Warnings That Should Be Fixed: Inferred Property
The ‘og:image’ property should be explicitly provided, even if a value can be inferred from other tags.
I then investigated further and was told by AI to add the following code to the theme’s functions.php file:
function add_open_graph_tags() {
if (is_single()) {
global $post;
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), ‘large’);
if ($thumbnail) {
echo ‘<meta property=”og:image” content=”‘ . esc_url($thumbnail[0]) . ‘” />’ . “\n”;
}
} elseif (is_home() || is_front_page()) {
// You can set a default og:image for your homepage here
echo ‘<meta property=”og:image” content=”URL_OF_YOUR_DEFAULT_IMAGE” />’ . “\n”;
}
}
The thing is that I don’t know what the URL_OF_YOUR_DEFAULT_IMAGE is. I tried with a random image url from my WordPress Media folder but the FB Debugger did not like that, either.
Can you please help? Many thanks and greetings, Lokita
Hey Lokita,
Enfold does not have functionality for setting which image should be used when sharing on social networks, you can use a plugin like Yoast SEO or similar for that.
Best regards,
Rikard
Hi,
Thanks for the update, we’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.
Best regards,
Rikard