【发布时间】:2019-07-23 02:52:04
【问题描述】:
我的问题很简单,我有一个包含证书的 WordPress 网站。但它仍然显示“不安全”。这是因为我的网站发出了大量 HTTP 请求吗?如果这是我尝试通过在 functions.php 中添加过滤器来解决的问题。过滤器如下所示:
function switch_to_relative_url($html, $id, $caption, $title, $align, $url, $size, $alt)
{
$imageurl = wp_get_attachment_image_src($id, $size);
$relativeurl = wp_make_link_relative($imageurl[0]);
$html = str_replace($imageurl[0],$relativeurl,$html);
return $html;
}
add_filter('image_send_to_editor','switch_to_relative_url',10,8);
我还尝试将 wp_get_attachment_image_src 替换为 wp_get_attachment_thumb_url。但是所有这些代码行都没有效果。我的网站似乎仍然发出相同的 HTTP 请求。我更关注图片,因为它们是来自网站的直接请求。
请告诉我有什么问题!
【问题讨论】:
标签: php wordpress ssl relative-path absolute-path