Sharing on Facebook – No thumbnail, no title, no description (naked link)
-
Hello everyone!
I have a foodblog and until now everything has worked great. I would share my posts on Facebook, it would use the featured image as a thumbnail, the author of the post, the title and the description. But today I tried to share something and it gave me an ugly, naked link.
I have no idea why it’s doing this, considering I did nothing different from my other posts. I ran the link through the Facebook debugger and it said this.
I tried to search on google but honestly I have no idea what to do. I do have a little knowledge of coding but every topic I found was very overwhelming to me.
Things I’ve already tried:
– Repost the articles
– Installed Yoast
– Added a bit of code to my functions.php (I read somewhere this could work):`function insert_image_src_rel_in_head() {
global $post;
if ( !is_singular()) //if it is not a post or a page
return;
if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
$default_image=”https://www.daysofflavour.nl/wp-content/uploads/2014/11/newheader1.png”; //replace this with a default image on your server or an image in your media library
echo ‘<meta property=”og:image” content=”‘ . $default_image . ‘”/>’;
}
else{
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘medium’ );
echo ‘<meta property=”og:image” content=”‘ . esc_attr( $thumbnail_src[0] ) . ‘”/>’;
}
echo “
“;
}`Can anyone help me? It’s really frustrating. Can it have anything to do with the fact that I recently upgraded to a newer wordpress version?
- The topic ‘Sharing on Facebook – No thumbnail, no title, no description (naked link)’ is closed to new replies.