简体   繁体   English

Facebook缓存打开的图形图像设置无法在Wordpress网站上正确显示

[英]Facebook caching open graph image settings won't display correctly for Wordpress site

In the header of our blog I've added the following to set the FB open graph image equal to the highlight image of the post: 在博客的标题中,我添加了以下内容,以将FB打开图图像设置为与帖子的突出显示图像相同:

<?php if ( has_post_thumbnail() ) : ?>
<meta property="og:image" content="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'hero-large') ); ?>"/>
<?php else : ?>
<meta property="og:image" content="http://myblog.com/apple-touch-icon-114x114-precomposed.png"/>
<?php endif; ?>

Then, when I load the page in production, if I look at the html in my head element I see the correct path to the post image: 然后,当我在生产环境中加载页面时,如果我查看head元素中的html,则会看到发布图片的正确路径:

<meta property="og:image" content="http://myblog.com/wp-content/uploads/2014/03/myimage.png"/>

However, if I paste a link to that post page into Facebook, three completely random images from past posts elsewhere on my blog appear as the Facebook post image choices. 但是,如果将指向该帖子页面的链接粘贴到Facebook中,则来自我博客其他位置的过去帖子的三个完全随机的图像将显示为Facebook帖子图像选择。

I don't have any open graph plugins installed and there's no caching issue (or caching plugin) doing this, so I'm confused why Facebook seems to be ignoring my og:image meta tag. 我没有安装任何开放式图形插件,并且这样做没有缓存问题(或缓存插件),所以我感到困惑,为什么Facebook似乎忽略了我的og:image meta标签。 Any suggestions on where I should be looking for a solution? 关于我应该在哪里寻找解决方案的任何建议?

http://developers.facebook.com/tools/debug插入您的URL,让调试器抓取您的页面并清除缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM