Languages: English • Italiano • (Add your language)
Convert full URL paths to relative 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.
<?php wp_make_link_relative( $link ) ?>
<?php echo wp_make_link_relative('http://localhost/wp_test/sample-page/'); ?>
This should output the following URL:
/wp_test/sample-page/
Since: 2.1.0
wp_make_link_relative() is located in wp-includes/formatting.php
.