我有一个奇怪的问题。 两周前,我将Wordpress网站从http迁移到了https。 我使用了Really Simple SSl插件来确保安全:https://wordpress.org/plugins/really-simple-ssl/ 这很有效。 但是在迁移之后,我看到我丢失了所有我喜欢的FB。
我找到了我在本文中想到的解决方案:https://really-simple-ssl.com/knowledge-base/how-to-recover-facebook-likes-after-moving-to-httpsssl/ 它来自与Really Simple SSL插件相同的作者。 我把代码放在我的主题的functions.php中。但很快我发现,在某些帖子中,计数已恢复,但在其他帖子上,计数为零:https://www.tina-turner.nl/blog/page/11/
我有3个网站,其中1个网站工作正常。 但在其他两个网站上,我遇到了问题。我开始停用所有插件并更改主题,但这并没有解决问题。 我搜索了互联网,但无法找到解决此问题的方法。
我还没有尝试过的一件事就是从同一个作者那里购买Really Simple Social插件。他说也许当我在该插件中激活og:url时它可能会起作用。 https://really-simple-ssl.com/downloads/really-simple-ssl-social/
但首先,我试图在不购买任何东西的情况下实现这一目标。 我尝试了一些代码。 functions.php中的原始代码是:
// Recover FB Counts
function rsssl_exclude_http_url($html) {
//replace the https url back to http
$html = str_replace('data-href="https://www.tina-turner.nl/blog', 'data-href="http://www.tina-turner.nl/blog', $html); return $html;
}
add_filter("rsssl_fixer_output","rsssl_exclude_http_url");
我尝试为og:url添加一些代码,但我对代码不满意。 这是我尝试过的,但是没有用:
// Recover FB Counts
function rsssl_exclude_http_url($html) {
$html = preg_replace('~<meta property="og:url" content="https://~', '<meta property="og:url" content="http://', $html, 1);
$html = str_replace('data-href="https://www.tina-turner.nl/blog', 'data-href="http://www.tina-turner.nl/blog', $html);
return $html;
}
add_filter("rsssl_fixer_output","rsssl_exclude_http_url");
该过滤器是必要的,因为Really Simple SSl插件设置从http到https的所有内容。
哦,要完成,我使用FB Like按钮的Add to Any插件。
有人可以帮我吗?
约翰娜