Php ssl网站上的WordPress不安全内容
我面临着在ssl wordpress上加载不安全内容的问题,rest一切正常,所有链接都在https下,但我们要回显的内容很少不显示为https。我尝试用插件来修复不安全的内容,但没有成功。下面是我们用来获取显示为http而不是https的图像的代码。我想知道如何强制将这些图像作为https加载Php ssl网站上的WordPress不安全内容,php,wordpress,ssl,Php,Wordpress,Ssl,我面临着在ssl wordpress上加载不安全内容的问题,rest一切正常,所有链接都在https下,但我们要回显的内容很少不显示为https。我尝试用插件来修复不安全的内容,但没有成功。下面是我们用来获取显示为http而不是https的图像的代码。我想知道如何强制将这些图像作为https加载 <?php $galleryImages = get_post_meta($post->ID, 'atak_portfolio_gallaryImages', true);
<?php
$galleryImages = get_post_meta($post->ID, 'atak_portfolio_gallaryImages', true);
if(is_array($galleryImages)){
foreach($galleryImages as $galleryImage)
{
?>
<a href="<?php echo $galleryImage; ?>">
<img class="alignnone size-full wp-image-1232" src="<?php echo $galleryImage; ?>" alt="project10-4" rel="lightbox" width="1024" height="673">
</a>
<?php
}
}
?>
第二点:
<?php
$galleryImages = get_post_meta($post->ID, 'atak_portfolio_gallaryImages', true);
if(is_array($galleryImages)){
foreach($galleryImages as $galleryImage)
{
?>
<a href="<?php echo $galleryImage; ?>">
<img class="alignnone size-full wp-image-1232" src="<?php echo $galleryImage; ?>" alt="project10-4" rel="lightbox" title="Atak Interactive Portfolio" width="1024" height="673">
</a>
<?php
}
}
?>
也许您应该从http(s)协议中删除URL
<?php
$galleryImages = get_post_meta($post->ID, 'atak_portfolio_gallaryImages', true);
if(is_array($galleryImages)){
foreach($galleryImages as $galleryImage)
{
$galleryImage = preg_replace( '#http[s]?:#i', '', $galleryImage );
?>
<a href="<?php echo $galleryImage; ?>">
<img class="alignnone size-full wp-image-1232" src="<?php echo $galleryImage; ?>" alt="project10-4" rel="lightbox" title="Atak Interactive Portfolio" width="1024" height="673">
</a>
<?php
}
}
你是否在管理员中正确设置了你的站点URL和主页URL?是的,我已经从那里正确设置了。你能显示你设置post_meta的代码吗。看起来您正在(更新|添加)u postu元调用中保存一个http://url。也不要忘记转义输出,搜索esc_url。