発生している問題・エラーメッセージ
WordPressで構築したサイトのSSL化をしました。
しかし「このサイトは安全ではありません」と表示されてしまいました。
コンソールでエラーを調べたところ、
「安全なページ上で (安全でない) 混在表示コンテンツ “http://www.xxxxxx.com/wp-content/uploads/2019/05/xxxxx.jpg” を読み込んでいます]が見つかりました。
記事内の最初の画像をアイキャッチ代わりに使ってる画像だけSSL化してくれないのですが、対処法ご存じの方いらっしゃいますでしょうか?
※他はすべてhttpsになっています。
対象の個所は以下のように表示させています。
####▽front-page.php
<?php query_posts('category_name=news&showposts=3'); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <li> <a href="<?php the_permalink(); ?>" style="background-image:url(<?php echo catch_that_image(); ?>);" class="newpost-img"></a> </li> <?php endwhile; endif; ?>####▽function.php
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src='"['"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = "https://www.mie-biyouhari.com/wp-content/themes/tsuisuma-pc/images/top/default.jpg";
}
return $first_img;
}
試したこと
以下の記事を参考にfunction.phpを修正してみましたが駄目でした。
参考記事)SSL化するときに、記事の最初の画像をアイキャッチとしてサムネイルにしたのをhttpsにする記述
https://hirocreate.com/wordpress/ssl%E5%8C%96%E3%81%99%E3%82%8B%E3%81%A8%E3%81%8D%E3%81%AB%E3%80%81%E8%A8%98%E4%BA%8B%E3%81%AE%E6%9C%80%E5%88%9D%E3%81%AE%E7%94%BB%E5%83%8F%E3%82%92%E3%82%A2%E3%82%A4%E3%82%AD%E3%83%A3%E3%83%83/
補足情報(FW/ツールのバージョンなど)
PHP 7.2.17
WordPressバージョン 5.2.2
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/07 01:19
2019/08/07 01:38