From d95b5196cca1fd6a6e3660f25c9f6406e07ac5d3 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 19 Nov 2014 01:53:24 +0000 Subject: [PATCH] Improvements to `wp_make_link_relative()`. * Support relative URL input. * When the URL being made relative has another URL as a parameter, don't make the second URL relative. Props voldemortensen. Fixes #30373. Built from https://develop.svn.wordpress.org/trunk@30383 git-svn-id: http://core.svn.wordpress.org/trunk@30380 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 411eaa8601..57cfcb1eac 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -3239,7 +3239,7 @@ function tag_escape($tag_name) { * @return string Absolute path. */ function wp_make_link_relative( $link ) { - return preg_replace( '|https?://[^/]+(/.*)|i', '$1', $link ); + return preg_replace( '|^(https?:)?//[^/]+(/.*)|i', '$2', $link ); } /**