Skip to content

Commit 789ad72

Browse files
authored
Try replacing hardcoded http
1 parent f57cf3d commit 789ad72

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/wp-includes/formatting.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4679,7 +4679,8 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) {
46794679
if ( ! str_contains( $url, ':' ) && ! in_array( $url[0], array( '/', '#', '?' ), true ) &&
46804680
! preg_match( '/^[a-z0-9-]+?\.php/i', $url )
46814681
) {
4682-
$url = 'http://' . $url;
4682+
$scheme = ( is_array( $protocols ) && 'https' === reset( $protocols ) ) ? 'https://' : 'http://';
4683+
$url = $scheme . $url;
46834684
}
46844685

46854686
// Replace ampersands and single quotes only when displaying.

0 commit comments

Comments
 (0)