【发布时间】:2014-06-10 10:56:08
【问题描述】:
我正在使用 Metaslider wordpress 插件 http://wordpress.org/plugins/ml-slider/ 并且我已经安装了 SSL 证书。但是幻灯片所在的页面告诉我页面上有一些不安全的元素。这些元素是幻灯片中默认使用 HTTP 加载的图像。有没有办法强制他们使用 HTTPS 加载?
【问题讨论】:
我正在使用 Metaslider wordpress 插件 http://wordpress.org/plugins/ml-slider/ 并且我已经安装了 SSL 证书。但是幻灯片所在的页面告诉我页面上有一些不安全的元素。这些元素是幻灯片中默认使用 HTTP 加载的图像。有没有办法强制他们使用 HTTPS 加载?
【问题讨论】:
只需在设置 > 常规中将默认地址更改为 http://。强制 https 的 Wordpress 插件不适用于 metaslider
【讨论】:
您可以在该特定页面上运行类似这样的某种功能。
在你的functions.php中
<?php
function filter_content_match_protocols( $content ) {
$search = $replace = get_bloginfo( 'home' );
if ( ! preg_match( '|/$|', $search ) )
$search = $replace = "$search/";
if ( is_ssl() ) {
$search = str_replace( 'https://', 'http://', $search );
$replace = str_replace( 'http://', 'https://', $replace );
}
else {
$search = str_replace( 'http://', 'https://', $search );
$replace = str_replace( 'https://', 'http://', $replace );
}
$content = str_replace( $search, $replace, $content );
return $content;
}
ob_start( 'filter_content_match_protocols' );
function filter_content_match_protocols_end() {
ob_end_flush();
}
add_action( 'shutdown', 'filter_content_match_protocols_end', -10 );
?>
【讨论】: