Skip to content

Commit 295d387

Browse files
authored
Update force-https.php
1 parent 2ed610f commit 295d387

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: force-https.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ function force_https_fix_resource_hints( $urls ) {
111111
return $urls;
112112
}
113113

114-
// enforce https on attachment metadata
115-
add_filter( 'wp_get_attachment_metadata', 'force_https_fix_attachment_metadata', 20 );
116-
function force_https_fix_attachment_metadata( $data ) {
114+
// enforce https on attachment metadata
115+
add_filter( 'wp_get_attachment_metadata', 'force_https_fix_attachment_metadata', 20, 2 );
116+
function force_https_fix_attachment_metadata( $data, $attachment_id ) {
117117
if ( isset( $data['file'] ) ) {
118-
$data['file'] = set_url_scheme( $data['file'], 'https' );
118+
$data['file'] = set_url_scheme( wp_get_attachment_url( $attachment_id ), 'https' );
119119
}
120120
if ( isset( $data['sizes'] ) && is_array( $data['sizes'] ) ) {
121121
foreach ( $data['sizes'] as &$size ) {
122122
if ( isset( $size['file'] ) ) {
123-
$size['file'] = set_url_scheme( $size['file'], 'https' );
123+
$size['file'] = set_url_scheme( wp_get_attachment_url( $attachment_id ), 'https' );
124124
}
125125
}
126126
}

0 commit comments

Comments
 (0)