Skip to content

Commit ef6e862

Browse files
authored
Update force-https.php
1 parent b652c68 commit ef6e862

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

force-https.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,14 @@ function($matches) {
120120

121121
// Enforce HTTPS on wp_resource_hints
122122
add_filter('wp_resource_hints', function($urls) {
123-
foreach ($urls as &$url) {
124-
$url['href'] = str_replace('http://', 'https://', $url['href']);
123+
if (is_array($urls)) {
124+
foreach ($urls as &$url) {
125+
if (is_array($url) && isset($url['href'])) {
126+
$url['href'] = str_replace('http://', 'https://', $url['href']);
127+
} elseif (is_string($url)) {
128+
$url = str_replace('http://', 'https://', $url);
129+
}
130+
}
125131
}
126132
return $urls;
127133
}, 20);

0 commit comments

Comments
 (0)