Core Function
View Source on Trac ↗ wp_parse_url()
wp_parse_url( mixed $url, mixed $component = -1 ) A wrapper for PHP's parse_url() function that handles consistency in the return values
Parameters 2 required
| Name / Type | Description |
|---|---|
| $url string | The URL to parse. Required |
| int | $component The specific component to retrieve. Use one of the PHP predefined constants to specify which one. Defaults to -1 (= return all parts as an array). Required |
Return Value
(mixed)
mixed False on parse failure; Array of URL components on success;
When a specific component has been requested: null if the component
doesn't exist in the given URL; a string or - in the case of
PHP_URL_PORT - integer when it does. See parse_url()'s return values.
Function Information
Since Version
4.4.0
Source File
wp-includes/http.php
Advertisement