Skip to content

Instantly share code, notes, and snippets.

@harisrozak
Last active August 29, 2015 14:22
Show Gist options
  • Save harisrozak/fa435676e48c8c293636 to your computer and use it in GitHub Desktop.
Save harisrozak/fa435676e48c8c293636 to your computer and use it in GitHub Desktop.
WordPress :: absolute path to url
// 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