sanitize_url( string $url, string[] $protocols = null )
Sanitizes a URL for database or redirect usage.
Description
See also
Parameters
- $url
-
(Required) The URL to be cleaned.
- $protocols
-
(Optional) An array of acceptable protocols.<br> Defaults to return value of wp_allowed_protocols().
Default value: null
Return
(string) The cleaned URL after esc_url() is run with the 'db' context.
Source
File: wp-includes/formatting.php
function sanitize_url( $url, $protocols = null ) {
_deprecated_function( __FUNCTION__, 'WP-2.8.0', 'esc_url_raw()' );
return esc_url_raw( $url, $protocols );
}
Changelog
Version | Description |
---|---|
5.9.0 | Restored (un-deprecated). |
2.8.0 | Deprecated in favor of esc_url_raw(). |
2.3.1 | Introduced. |