UTILITY

url_path()

Extract the path component of a URL.

Signature

mixed url_path(string $url, mixed $default = null)

Example

url_path('https://example.com/docs/page'); // '/docs/page'

Available from: 1.5.0

Reference navigation

Previous: url_host()

Next: url_with()

Back to utilities