Site icon 峰哥分享

A quick fix for WordPress Hestia theme insecure image warning

After replacing the header background image of Hestia theme. There appeared a security warning on Chrome browser. Then I noticed the background image is linked from HTTP. I believe this issue is caused by the HTTPS reserve proxy I used. But on the other hand, the theme code should handle this case as I have set $_SERVER[‘HTTPS’]=’on’;

To fix this problem, I use the following grep command to locate the file.

grep -r --include=*.php "header-filter" .

I found the code is in the following file.

./wp-content/themes/hestia/inc/views/front-page/class-hestia-big-title-section.php

Start from line 97. Update the original code as following:



<div class="header-filter"
<?php if ( ! empty( $big_title_background ) ) { $background = esc_url( $big_title_background ); if (is_ssl()){ $background = str_replace('http:', 'https:', $background); } echo 'style="background-image: url(' . $background . ')"'; } ?>
></div>



Then problem solved.

Exit mobile version