我有一个奇怪的问题。两周前,我将我的 Wordpress 网站从 http 迁移到 https。我使用了真正简单的 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/ 它来自同一作者作为真正简单的 SSL 插件。我把代码放在我的主题的functions.php中。但很快我发现,在某些帖子上,计数已恢复,但在其他帖子上,计数为零:https ://www.tina-turner.nl/blog/page/11/
我有 3 个网站,其中 1 个网站运行良好。但在其他 2 个站点上,我遇到了问题。我从停用所有插件开始,还更改了主题,但这并没有解决问题。我搜索了互联网,但找不到解决此问题的方法。
我还没有尝试过的一件事是从同一位作者那里购买了真正简单的社交插件。他说也许当我激活那个插件中的 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");
该过滤器是必要的,因为真正简单的 Ssl 插件设置了从 http 到 https 的所有内容。
哦,为了完整起见,我为 FB Like 按钮使用了 Add to Any 插件。
有人可以帮我吗?
约翰娜