Sanitizes a URL for database or redirect usage.
$urlstringrequired
$protocolsstring[]optional
Default:null
'db' context.function sanitize_url( $url, $protocols = null ) {
return esc_url( $url, $protocols, 'db' );
}
| Version | Description |
|---|---|
| 5.9.0 | Restored (un-deprecated). |
| 2.8.0 | Deprecated in favor of esc_url_raw() . |
| 2.3.1 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/sanitize_url