Last active
August 29, 2015 14:22
-
-
Save harisrozak/fa435676e48c8c293636 to your computer and use it in GitHub Desktop.
WordPress :: absolute path to url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WordPress absolute path to url | |
function path_to_url($path) | |
{ | |
$url = str_replace($_SERVER['DOCUMENT_ROOT'], '', $path); | |
$http_proto = is_ssl() ? "https://" : "http://"; | |
return $http_proto . $_SERVER['SERVER_NAME'] . $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment