Core Function
View Source on Trac ↗ sanitize_url()
sanitize_url( mixed $url, mixed $protocols = null ) Sanitizes a URL for database or redirect usage.
Parameters 2 required
| Name / Type | Description |
|---|---|
| $url string | The URL to be cleaned. Required |
| string[] | $protocols Optional. An array of acceptable protocols. Defaults to return value of wp_allowed_protocols(). Required |
Return Value
(string)
The cleaned URL after esc_url() is run with the 'db' context.
Function Information
Since Version
2.3.1
Source File
wp-includes/formatting.php
Advertisement