开发者

How to Get the Exect Image at Facebook Like Post?

开发者 https://www.devze.com 2023-03-26 06:22 出处:网络
Hello friends I added my like button on blog. but when anyone like that post, on facebook its showing same post but with the different image. what code i\'ll do. right now i add that one

Hello friends I added my like button on blog. but when anyone like that post, on facebook its showing same post but with the different image. what code i'll do. right now i add that one

     //Adding the Open Graph in the Language Attributes
function wpc_fb_opengraph() {
$wpc_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
?>
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="fb:app_id" content="1809-------303">*(hide Id)*
<meta property="fb:admins" content="C------a开发者_如何学Go"/>
<meta property="og:image" content="<?php echo $wpc_image_url[0] ?>"/>
<?php }

add_action('wp_head', 'wpc_fb_opengraph');

help me please to show same image with same url thanx kumar


It'll show same image everytime.

Be sure you wait after changing it, facebook is caching it heavily

0

精彩评论

暂无评论...
验证码 换一张
取 消