Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_make_link_relative [ WordPress Function ]

wp_make_link_relative ( $link )
Parameters:
  • (string) $link Full URL path.
Returns:
  • (string) Absolute path.
Defined at:



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.

Source


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

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics