wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_make_link_relative › WordPress Function

Depuis2.1.0
Dépréciéen/a
wp_make_link_relative ( $link )
Paramètres:
  • (string) $link Full URL path.
    Requis: Oui
Retourne:
  • (string) Absolute path.
Défini(e) dans:
Codex:
Changelog:
  • 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.


Source

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