esc_url_raw( string $url, string[] $protocols = null ): string
Sanitizes a URL for database or redirect usage.
Contents
Description
This function is an alias for sanitize_url() .
See also
Parameters
-
$url
string Required -
The URL to be cleaned.
-
$protocols
string[] Optional -
An array of acceptable protocols.
Defaults to return value of wp_allowed_protocols() .Default:
null
Return
string The cleaned URL after sanitize_url() is run.
More Information
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, redirects and HTTP requests.
This function is not safe to use for displaying the URL, use esc_url() instead.
Source
File: wp-includes/formatting.php
.
View all references
function esc_url_raw( $url, $protocols = null ) {
return sanitize_url( $url, $protocols );
}
Changelog
Version | Description |
---|---|
6.1.0 | Turned into an alias for sanitize_url() . |
2.8.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Right and Wrong usage