我试图手动填充打开的图形标记,但在设置og:image
标签
在单个贴子页面中,我将其设置为:
<?php
$thumbnailSrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), \'medium\');
$image = esc_attr($thumbnailSrc[0]);
?>
<meta property="og:image" content="<?php echo $image ?>">
结果是:
<meta property="og:image" content="/wp-content/uploads/image.jpg">
在Open Graph调试器上,我发现以下错误:
Object at URL \'http://website.com\' of type \'article\' is invalid because the given value \'/wp-content/uploads/image.jpg\' for property \'og:image:url\' could not be parsed as type \'url\'.
如何获取附件,使url为:
http://website.com/wp-content/uploads/image.jpg ?