Sanitizes a URL for database or redirect usage.
This function is an alias for sanitize_url() .
$urlstringrequired
$protocolsstring[]optional
Default:null
The esc_url_raw() function is similar to esc_url() (and actually uses it), but unlike esc_url() it does not replace entities for display. The resulting URL is safe to use in database queries and redirects.
Please do not use this function as the only sanitizer for HTTP requests, as this function is unable to sanitize against security attacks such as SSRF.
This function is not safe to use for displaying the URL, use esc_url() instead.
function esc_url_raw( $url, $protocols = null ) {
return sanitize_url( $url, $protocols );
}
| Version | Description |
|---|---|
| 6.1.0 | Turned into an alias for sanitize_url() . |
| 2.8.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/esc_url_raw