Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Facebook在分享wordpress文章时不显示缩略图或标题_Wordpress_Facebook_Url_Share - Fatal编程技术网

Facebook在分享wordpress文章时不显示缩略图或标题

Facebook在分享wordpress文章时不显示缩略图或标题,wordpress,facebook,url,share,Wordpress,Facebook,Url,Share,在过去的两天里,我们的链接遇到了一些问题:当我们想在facebook上共享一个链接时,它不识别它(它既没有显示thmbnail,也没有显示标题)。 facebook的调试器(显示以下错误:“URL请求了HTTP重定向,但无法遵循。” 对于URL“”,它给出了规范URL“”,这意味着它添加了SIeUZ 对于其他一些,调试器显示错误:“无法将主机名解析为有效的IP地址。”并且规范URL是正确的 我们在那两天之前发表的那篇文章写得很好 在编辑了一些代码之后,问题就出现了 我们试图猜测问题的原因,我们想

在过去的两天里,我们的链接遇到了一些问题:当我们想在facebook上共享一个链接时,它不识别它(它既没有显示thmbnail,也没有显示标题)。 facebook的调试器(显示以下错误:“URL请求了HTTP重定向,但无法遵循。” 对于URL“”,它给出了规范URL“”,这意味着它添加了SIeUZ

对于其他一些,调试器显示错误:“无法将主机名解析为有效的IP地址。”并且规范URL是正确的

我们在那两天之前发表的那篇文章写得很好

在编辑了一些代码之后,问题就出现了

我们试图猜测问题的原因,我们想知道它是否与DNS、代码或主机服务器有关

有什么帮助吗


诚恳地说

不确定这是否是导致错误的原因,但在代码中,您有重复的og元数据标记

<!-- This site is optimized with the Yoast WordPress SEO plugin v1.6.3 - https://yoast.com/wordpress/plugins/seo/ -->
<meta name="description" content="Découvrez le nouveau teaser du Galaxy S6 !"/>
<link rel="canonical" href="http://www.ozap.tv/decouvrez-nouveau-teaser-du-galaxy-s6/" />
<meta property="og:locale" content="fr_FR" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Découvrez le nouveau teaser du Galaxy S6 !" />
<meta property="og:description" content="Découvrez le nouveau teaser du Galaxy S6 !" />
<meta property="og:url" content="http://www.ozap.tv/decouvrez-nouveau-teaser-du-galaxy-s6/" />
<meta property="og:site_name" content="Ozap" />
<meta property="article:section" content="Actualités" />
<meta property="article:published_time" content="2015-02-19T09:31:40+00:00" />
<meta property="og:image" content="http://www.ozap.tv/wp-content/uploads/2015/02/next-galaxy-charging.jpg" />
<meta property="og:image" content="http://images.frandroid.com/wp-content/uploads/2015/02/s6-puissance-teaser-630x232.png" />
<!-- / Yoast WordPress SEO plugin. -->


这可能会混淆Facebook,因为这是Facebook获取信息的地方

*编辑

我发现的另一件奇怪的事情是以下重定向:

选中链接:

重定向类型:找到302
重定向到:

我在wordpress中查看了代码

第一组代码是由Yoast SEO插件编写的

第二个是由function.php文件中的函数编写的

现在我已经删除了Yoast SEO插件,我可以在使用调试器工具后共享文章。我输入文章的URL,然后单击“获取新的刮取信息”。 在淡化Yoast SEO之后,重定向问题似乎得到了解决


这是facebook的cach中的一个问题吗?

我再次回到这个问题。我需要有Yoast SEO插件,我也需要使用facebook小部件,所以我必须以不同的方式解决这个问题。我想知道我是否从文件“function.php”中删除了我所说的函数,如果我再次安装这些小部件和插件,我会再次遇到同样的问题吗(复制ogtags)

函数dp\u fb\u ogtags(){
$site_name=esc_attr(获取选项('blogname');
$type=is_front_page()?“网站”:“文章”;
$url=get_permalink();
$title=wp|title(“|”,false,“right”);
$desc=dp_get_doc_desc();
$image='';
$admins='';
//获取图像
if(单数形式){
全球$员额;
//通过特征图像获取图像
$image=dp\u thumb\u url('large',false,$post->ID);
//从post附件获取图像
if(空($image)和&$images=get_children('post_type=attachment&post_mime_type=image&post_parent='。$post->ID))
如果(是数组($images)&&!空($images))
$image=wp\u get\u attachment\u thumb\u url(当前($images)->ID);
//从帖子内容中获取第一张图片
if(空($image)和&preg_匹配('/post_内容,$matches))
$image=$matches[2];
}
//生成元标记
$nl=“\n”;
$tags='';
$tags.=''。$nl;
$tags.=''。$nl;
$tags.=''。$nl;
如果($标题)
$tags.=''。$nl;
如果($desc)
$tags.=''。$nl;
如果($image)
$tags.=''。$nl;
如果($admins)
$tags.=''。$nl;
echo$标签//*/
}
<meta property="og:site_name" content="Ozap" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://www.ozap.tv/decouvrez-nouveau-teaser-du-galaxy-s6/" />
<meta property="og:title" content="Découvrez le nouveau teaser du Galaxy S6 !" />
<meta property="og:description" content="La vague de teasing orchestrée la semaine dernière par Samsung évoquait les capacités photo du futur Galaxy (S6) dont l’annonce est prévue au prochain Mobile World Congress. Cette semaine, le Coréen c" />
<meta property="og:image" content="http://www.ozap.tv/wp-content/uploads/2015/02/next-galaxy-charging.jpg" />
  function dp_fb_ogtags(){
            $site_name = esc_attr(get_option('blogname'));
            $type = is_front_page() ? 'website' : 'article';
            $url = get_permalink();
            $title = wp_title( '|', false, 'right' );
            $desc = dp_get_doc_desc();
            $image = '';
            $admins = '';

            // Get image
                if (is_singular()) {
                    global $post;

                    // Get image by feature image
                    $image = dp_thumb_url('large', false, $post->ID);

                    // Get image from post attachments
                    if(empty($image) && $images = get_children('post_type=attachment&post_mime_type=image&post_parent='.$post->ID))
                        if (is_array($images) && !empty($images))
                            $image = wp_get_attachment_thumb_url(current($images)->ID);

                    // Get first image from post content
                    if(empty($image) && preg_match('/<img[^>]*src=([\'"])(.*?)\\1/i', $post->post_content, $matches))
                        $image = $matches[2];
                }



            // Generate meta tags
            $nl = "\n";
            $tags = '';
            $tags .= '<meta property="og:site_name" content="'.$site_name.'" />'.$nl;
            $tags .= '<meta property="og:type" content="'.$type.'" />'.$nl;
            $tags .= '<meta property="og:url" content="'.$url.'" />'.$nl;
            if($title)
                $tags .= '<meta property="og:title" content="'.$title.'" />'.$nl;
            if($desc)
                $tags .= '<meta property="og:description" content="'.  esc_attr($desc).'" />'.$nl;
            if($image)
                $tags .= '<meta property="og:image" content="'.$image.'" />'.$nl;
            if($admins)
                $tags .= '<meta property="fb:admins" content="'.esc_attr($admins).'" />'.$nl;

            echo $tags;//*/
        }