Make WordPress Core


Ignore:
Timestamp:
11/19/2014 01:52:57 AM (11 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r30105 r30383  
    32403240 */
    32413241function wp_make_link_relative( $link ) {
    3242     return preg_replace( '|https?://[^/]+(/.*)|i', '$1', $link );
     3242    return preg_replace( '|^(https?:)?//[^/]+(/.*)|i', '$2', $link );
    32433243}
    32443244
Note: See TracChangeset for help on using the changeset viewer.