I have installed a SSL certificate on a very old WP site. The plugins and WP itself have been autoupdating but the theme is long out of date and support stopped nearly three years ago. This is the theme https://wordpress.org/themes/white/ The site is still on 1.0.1 (Sept 2014). There have been five revisions since then, the last of them in Feb 2017. https://themes.trac.wordpress.org/log/white?limit=100&mode=stop_on_copy&format=rss . I have managed to install the certificate and updated links to https so that's OK. Unfortunately, a couple of image links are now broken - one of which is the logo! I have spent hours looking into this on the web and it would seem that this is most probably related to php (about which I know nothing). When I inspect the broken logo I see this....
<img alt="Featured Logo" src="[site_url_secure]/wp-content/uploads/****png">
A couple of years ago someone said they'd fixed the issue by
removing [site_url_secure] from admin>functions>functions.filter.php
but i don't know how to do this. Can anyone advise me please?
function of_filter_save_media_upload($data) {
if(!is_array($data)) return $data;
foreach ($data as $key => $value) {
if (is_string($value)) {
$data[$key] = str_replace(
array(
site_url('', 'http'),
site_url('', 'https'),
),
array(
'[site_url]',
'[site_url_secure]',
),
$value
);
}
}
return $data;
}
add_filter('of_options_before_save', 'of_filter_save_media_upload');
function of_filter_load_media_upload($data) {
if(!is_array($data)) return $data;
foreach ($data as $key => $value) {
if (is_string($value) && preg_match("/\[site_url(_url_secure)?\]/", $value)) {
$data[$key] = str_replace(
array(
'[site_url]',
'[site_url_secure]',
),
array(
site_url('', 'http'),
site_url('', 'https'),
),
$value
);
}
}
return $data;
}
add_filter('of_options_after_load', 'of_filter_load_media_upload');
resolved ! Just change:
preg_match("/\[site_url(_url_secure)?\]/"
to :
preg_match("/\[site_url(_secure)?\]/"
in your code :)