mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
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
This commit is contained in:
parent
e34a587ea6
commit
d95b5196cc
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user