编程语言
首页 > 编程语言> > php-WordPress中多个作者的Facebook Open-graph标记

php-WordPress中多个作者的Facebook Open-graph标记

作者:互联网

我一直在尝试将facebook article:author元标记添加到wordpress中,不幸的是,我不知道如何为多个作者添加它.到目前为止,这是我所做的,但仍未在Facebook共享中显示作者的名字.

<meta property="article:author" content= "<?php $author = get_the_author(); ?>" />

解决方法:

根据https://developers.facebook.com/docs/reference/opengraph/object-type/article#properties条:作者包含

An array of Facebook profile URLs or IDs of the authors for this article.

截至https://developers.facebook.com/docs/opengraph/creating-custom-stories/#propertytypes-simple

You define an array value by repeating the same meta tag name for each element of the array.

<meta property="cookbook:ingredients" content="Chocolate"> 
<meta property="cookbook:ingredients" content="Sugar"> 
<meta property="cookbook:ingredients" content="Butter"> 

确保您定义

<meta property="og:type" content="article" /> 

也一样

标签:facebook,opengraph,wordpress,php,facebook-graph-api
来源: https://codeday.me/bug/20191121/2052886.html