Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_make_link_relative ›

Da2.1.0
Deprecaton/a
wp_make_link_relative ( $link )
Parametri:
  • (string) $link Full URL path.
    Richiesto:
Ritorna:
  • (string) Absolute path.
Definito a:
Codex:
ChangeLog:
  • 4.1.0

Convert 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.



Sorgenti

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