因此,我始终使用以下代码段强制使用默认的OG:Image和Twitter:Card图像:
add_filter(\'wpseo_pre_analysis_post_content\',\'mysite_opengraph_content\');
function mysite_opengraph_content($val){return \'<img src="https://www.rafaeldejongh.com/wp-content/uploads/2017/08/RafaelDeJongh-Web-Developer-3D-Artist.jpg" alt="Rafaël De Jongh - Web Developer | 3D Artist"/>\' . $val;}
然而,这似乎不再起作用了,有没有人知道有什么不同的方法可以像过去使用上述代码那样解决这个问题?或者在某种程度上改进我模拟的代码:
function default_opengraph(){return \'https://www.tzotkiekske.be/wp-content/uploads/2017/10/tzotkiekske-fb.jpg\';}
add_filter(\'wpseo_opengraph_image\',\'default_opengraph\');
add_filter(\'wpseo_twitter_image\',\'default_opengraph\');
但这允许将此添加到OG:图像,而不是替换它。