wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



wp_make_link_relative › WordPress Function

Od2.1.0
Przestarzałyn/a
wp_make_link_relative ( $link )
Parametry:
  • (string) $link Full URL path.
    Wymagane: Tak
Powrót:
  • (string) Absolute path.
Zdefiniowane na:
Codex:
Dziennik zmian:
  • 4.1.0

Converts full URL paths to absolute paths.

Removes the http or https protocols and the domain. Keeps the path '/' at the beginning, so it isn't a true relative link, but from the web root base.


Źródło

function wp_make_link_relative( $link ) {
	return preg_replace( '|^(https?:)?//[^/]+(/?.*)|i', '$2', $link );
}