diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index df1e490750..822f4dd337 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -2645,11 +2645,15 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) { $url = str_replace( "'", ''', $url ); } - if ( ! is_array( $protocols ) ) - $protocols = wp_allowed_protocols(); - $good_protocol_url = wp_kses_bad_protocol( $url, $protocols ); - if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) - return ''; + if ( '/' === $url[0] ) { + $good_protocol_url = $url; + } else { + if ( ! is_array( $protocols ) ) + $protocols = wp_allowed_protocols(); + $good_protocol_url = wp_kses_bad_protocol( $url, $protocols ); + if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) + return ''; + } return apply_filters('clean_url', $good_protocol_url, $original_url, $_context); }