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.
<?php esc_url_raw( $url, $protocols ); ?>
<!-- Right -->
<?php
$url = 'http://wordpress.org';
$response = wp_remote_get( esc_url_raw( $url ) ); // no need to escape entities
if ( !is_wp_error( $response ) ) {
echo wp_remote_retrieve_body( $response );
}
?>
<!-- Wrong! Use esc_url instead! -->
<img src='<?php echo esc_url_raw( $url ); ?>' />
<a href='<?php echo esc_url_raw( $url ); ?>'>WordPress</a>
esc_url_raw() is located in wp-includes/formatting.php
.
See: Data Validation article for an in-depth discussion of input and output sanitization.